diff --git a/tests/integrations/launchdarkly/test_launchdarkly.py b/tests/integrations/launchdarkly/test_launchdarkly.py index e7576bb469..9b2bbb6b86 100644 --- a/tests/integrations/launchdarkly/test_launchdarkly.py +++ b/tests/integrations/launchdarkly/test_launchdarkly.py @@ -22,7 +22,12 @@ def test_launchdarkly_integration( sentry_init, use_global_client, capture_events, uninstall_integration ): td = TestData.data_source() - config = Config("sdk-key", update_processor_class=td) + td.update(td.flag("hello").variation_for_all(True)) + td.update(td.flag("world").variation_for_all(True)) + # Disable background requests as we aren't using a server. + config = Config( + "sdk-key", update_processor_class=td, diagnostic_opt_out=True, send_events=False + ) uninstall_integration(LaunchDarklyIntegration.identifier) if use_global_client: @@ -33,10 +38,6 @@ def test_launchdarkly_integration( client = LDClient(config=config) sentry_init(integrations=[LaunchDarklyIntegration(ld_client=client)]) - # Set test values - td.update(td.flag("hello").variation_for_all(True)) - td.update(td.flag("world").variation_for_all(True)) - # Evaluate client.variation("hello", Context.create("my-org", "organization"), False) client.variation("world", Context.create("user1", "user"), False) @@ -59,7 +60,16 @@ def test_launchdarkly_integration_threaded( sentry_init, capture_events, uninstall_integration ): td = TestData.data_source() - client = LDClient(config=Config("sdk-key", update_processor_class=td)) + td.update(td.flag("hello").variation_for_all(True)) + td.update(td.flag("world").variation_for_all(True)) + client = LDClient( + config=Config( + "sdk-key", + update_processor_class=td, + diagnostic_opt_out=True, # Disable background requests as we aren't using a server. + send_events=False, + ) + ) context = Context.create("user1") uninstall_integration(LaunchDarklyIntegration.identifier) @@ -75,8 +85,6 @@ def task(flag_key): sentry_sdk.set_tag("task_id", flag_key) sentry_sdk.capture_exception(Exception("something wrong!")) - td.update(td.flag("hello").variation_for_all(True)) - td.update(td.flag("world").variation_for_all(False)) # Capture an eval before we split isolation scopes. client.variation("hello", context, False) @@ -104,7 +112,7 @@ def task(flag_key): assert events[2]["contexts"]["flags"] == { "values": [ {"flag": "hello", "result": True}, - {"flag": "world", "result": False}, + {"flag": "world", "result": True}, ] } @@ -118,7 +126,16 @@ def test_launchdarkly_integration_asyncio( asyncio = pytest.importorskip("asyncio") td = TestData.data_source() - client = LDClient(config=Config("sdk-key", update_processor_class=td)) + td.update(td.flag("hello").variation_for_all(True)) + td.update(td.flag("world").variation_for_all(True)) + client = LDClient( + config=Config( + "sdk-key", + update_processor_class=td, + diagnostic_opt_out=True, # Disable background requests as we aren't using a server. + send_events=False, + ) + ) context = Context.create("user1") uninstall_integration(LaunchDarklyIntegration.identifier) @@ -135,8 +152,6 @@ async def task(flag_key): async def runner(): return asyncio.gather(task("world"), task("other")) - td.update(td.flag("hello").variation_for_all(True)) - td.update(td.flag("world").variation_for_all(False)) # Capture an eval before we split isolation scopes. client.variation("hello", context, False) @@ -163,7 +178,7 @@ async def runner(): assert events[2]["contexts"]["flags"] == { "values": [ {"flag": "hello", "result": True}, - {"flag": "world", "result": False}, + {"flag": "world", "result": True}, ] }