Skip to content

Commit

Permalink
Merge branch 'master' into fix/preserve-arq-kwdefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana authored Jan 7, 2025
2 parents 7a480dd + fd22494 commit 380df84
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions tests/integrations/launchdarkly/test_launchdarkly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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},
]
}

Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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},
]
}

Expand Down

0 comments on commit 380df84

Please sign in to comment.