Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/amplitude_experiment/local/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, debug: bool = False,
self.cohort_sync_config.cohort_server_url = EU_COHORT_SYNC_URL

self.stream_server_url = stream_server_url
if stream_server_url == DEFAULT_SERVER_URL and server_zone == ServerZone.EU:
if stream_server_url == DEFAULT_STREAM_URL and server_zone == ServerZone.EU:
self.stream_server_url = EU_STREAM_SERVER_URL

self.flag_config_polling_interval_millis = flag_config_polling_interval_millis
Expand Down
18 changes: 18 additions & 0 deletions tests/local/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
import unittest

from src.amplitude_experiment.local.config import LocalEvaluationConfig
from src.amplitude_experiment.server_zone import ServerZone


class LocalEvaluationConfigStreamingTestCase(unittest.TestCase):
def test_eu_uses_eu_streaming_endpoint(self):
config = LocalEvaluationConfig(stream_updates=True, server_zone=ServerZone.EU)
self.assertEqual(config.stream_server_url, 'https://stream.lab.eu.amplitude.com')

def test_us_uses_us_streaming_endpoint(self):
config = LocalEvaluationConfig(stream_updates=True, server_zone=ServerZone.US)
self.assertEqual(config.stream_server_url, 'https://stream.lab.amplitude.com')

def test_eu_keeps_custom_streaming_endpoint(self):
for url in ('https://stream.example.com', 'https://api.lab.amplitude.com'):
with self.subTest(url=url):
config = LocalEvaluationConfig(stream_updates=True, server_zone=ServerZone.EU,
stream_server_url=url)
self.assertEqual(config.stream_server_url, url)


class LocalEvaluationConfigLoggerTestCase(unittest.TestCase):
Expand Down
Loading