@@ -22,7 +22,12 @@ def test_launchdarkly_integration(
2222 sentry_init , use_global_client , capture_events , uninstall_integration
2323):
2424 td = TestData .data_source ()
25- config = Config ("sdk-key" , update_processor_class = td )
25+ td .update (td .flag ("hello" ).variation_for_all (True ))
26+ td .update (td .flag ("world" ).variation_for_all (True ))
27+ # Disable background requests as we aren't using a server.
28+ config = Config (
29+ "sdk-key" , update_processor_class = td , diagnostic_opt_out = True , send_events = False
30+ )
2631
2732 uninstall_integration (LaunchDarklyIntegration .identifier )
2833 if use_global_client :
@@ -33,10 +38,6 @@ def test_launchdarkly_integration(
3338 client = LDClient (config = config )
3439 sentry_init (integrations = [LaunchDarklyIntegration (ld_client = client )])
3540
36- # Set test values
37- td .update (td .flag ("hello" ).variation_for_all (True ))
38- td .update (td .flag ("world" ).variation_for_all (True ))
39-
4041 # Evaluate
4142 client .variation ("hello" , Context .create ("my-org" , "organization" ), False )
4243 client .variation ("world" , Context .create ("user1" , "user" ), False )
@@ -59,7 +60,16 @@ def test_launchdarkly_integration_threaded(
5960 sentry_init , capture_events , uninstall_integration
6061):
6162 td = TestData .data_source ()
62- client = LDClient (config = Config ("sdk-key" , update_processor_class = td ))
63+ td .update (td .flag ("hello" ).variation_for_all (True ))
64+ td .update (td .flag ("world" ).variation_for_all (True ))
65+ client = LDClient (
66+ config = Config (
67+ "sdk-key" ,
68+ update_processor_class = td ,
69+ diagnostic_opt_out = True , # Disable background requests as we aren't using a server.
70+ send_events = False ,
71+ )
72+ )
6373 context = Context .create ("user1" )
6474
6575 uninstall_integration (LaunchDarklyIntegration .identifier )
@@ -75,8 +85,6 @@ def task(flag_key):
7585 sentry_sdk .set_tag ("task_id" , flag_key )
7686 sentry_sdk .capture_exception (Exception ("something wrong!" ))
7787
78- td .update (td .flag ("hello" ).variation_for_all (True ))
79- td .update (td .flag ("world" ).variation_for_all (False ))
8088 # Capture an eval before we split isolation scopes.
8189 client .variation ("hello" , context , False )
8290
@@ -104,7 +112,7 @@ def task(flag_key):
104112 assert events [2 ]["contexts" ]["flags" ] == {
105113 "values" : [
106114 {"flag" : "hello" , "result" : True },
107- {"flag" : "world" , "result" : False },
115+ {"flag" : "world" , "result" : True },
108116 ]
109117 }
110118
@@ -118,7 +126,16 @@ def test_launchdarkly_integration_asyncio(
118126 asyncio = pytest .importorskip ("asyncio" )
119127
120128 td = TestData .data_source ()
121- client = LDClient (config = Config ("sdk-key" , update_processor_class = td ))
129+ td .update (td .flag ("hello" ).variation_for_all (True ))
130+ td .update (td .flag ("world" ).variation_for_all (True ))
131+ client = LDClient (
132+ config = Config (
133+ "sdk-key" ,
134+ update_processor_class = td ,
135+ diagnostic_opt_out = True , # Disable background requests as we aren't using a server.
136+ send_events = False ,
137+ )
138+ )
122139 context = Context .create ("user1" )
123140
124141 uninstall_integration (LaunchDarklyIntegration .identifier )
@@ -135,8 +152,6 @@ async def task(flag_key):
135152 async def runner ():
136153 return asyncio .gather (task ("world" ), task ("other" ))
137154
138- td .update (td .flag ("hello" ).variation_for_all (True ))
139- td .update (td .flag ("world" ).variation_for_all (False ))
140155 # Capture an eval before we split isolation scopes.
141156 client .variation ("hello" , context , False )
142157
@@ -163,7 +178,7 @@ async def runner():
163178 assert events [2 ]["contexts" ]["flags" ] == {
164179 "values" : [
165180 {"flag" : "hello" , "result" : True },
166- {"flag" : "world" , "result" : False },
181+ {"flag" : "world" , "result" : True },
167182 ]
168183 }
169184
0 commit comments