@@ -22,7 +22,12 @@ def test_launchdarkly_integration(
22
22
sentry_init , use_global_client , capture_events , uninstall_integration
23
23
):
24
24
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
+ )
26
31
27
32
uninstall_integration (LaunchDarklyIntegration .identifier )
28
33
if use_global_client :
@@ -33,10 +38,6 @@ def test_launchdarkly_integration(
33
38
client = LDClient (config = config )
34
39
sentry_init (integrations = [LaunchDarklyIntegration (ld_client = client )])
35
40
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
-
40
41
# Evaluate
41
42
client .variation ("hello" , Context .create ("my-org" , "organization" ), False )
42
43
client .variation ("world" , Context .create ("user1" , "user" ), False )
@@ -59,7 +60,16 @@ def test_launchdarkly_integration_threaded(
59
60
sentry_init , capture_events , uninstall_integration
60
61
):
61
62
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
+ )
63
73
context = Context .create ("user1" )
64
74
65
75
uninstall_integration (LaunchDarklyIntegration .identifier )
@@ -75,8 +85,6 @@ def task(flag_key):
75
85
sentry_sdk .set_tag ("task_id" , flag_key )
76
86
sentry_sdk .capture_exception (Exception ("something wrong!" ))
77
87
78
- td .update (td .flag ("hello" ).variation_for_all (True ))
79
- td .update (td .flag ("world" ).variation_for_all (False ))
80
88
# Capture an eval before we split isolation scopes.
81
89
client .variation ("hello" , context , False )
82
90
@@ -104,7 +112,7 @@ def task(flag_key):
104
112
assert events [2 ]["contexts" ]["flags" ] == {
105
113
"values" : [
106
114
{"flag" : "hello" , "result" : True },
107
- {"flag" : "world" , "result" : False },
115
+ {"flag" : "world" , "result" : True },
108
116
]
109
117
}
110
118
@@ -118,7 +126,16 @@ def test_launchdarkly_integration_asyncio(
118
126
asyncio = pytest .importorskip ("asyncio" )
119
127
120
128
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
+ )
122
139
context = Context .create ("user1" )
123
140
124
141
uninstall_integration (LaunchDarklyIntegration .identifier )
@@ -135,8 +152,6 @@ async def task(flag_key):
135
152
async def runner ():
136
153
return asyncio .gather (task ("world" ), task ("other" ))
137
154
138
- td .update (td .flag ("hello" ).variation_for_all (True ))
139
- td .update (td .flag ("world" ).variation_for_all (False ))
140
155
# Capture an eval before we split isolation scopes.
141
156
client .variation ("hello" , context , False )
142
157
@@ -163,7 +178,7 @@ async def runner():
163
178
assert events [2 ]["contexts" ]["flags" ] == {
164
179
"values" : [
165
180
{"flag" : "hello" , "result" : True },
166
- {"flag" : "world" , "result" : False },
181
+ {"flag" : "world" , "result" : True },
167
182
]
168
183
}
169
184
0 commit comments