@@ -31,6 +31,7 @@ def test_update_or_create(self):
31
31
organization_id = self .organization .id ,
32
32
num_samples = 100 ,
33
33
sample_rate = 0.5 ,
34
+ query = "environment:prod" ,
34
35
)
35
36
36
37
end2 = timezone .now () + timedelta (hours = 1 )
@@ -42,6 +43,7 @@ def test_update_or_create(self):
42
43
organization_id = self .organization .id ,
43
44
num_samples = 100 ,
44
45
sample_rate = 0.5 ,
46
+ query = "environment:prod" ,
45
47
)
46
48
47
49
assert rule .id == updated_rule .id
@@ -64,6 +66,7 @@ def create_rule_for_env(env_idx: int):
64
66
organization_id = self .organization .id ,
65
67
num_samples = 100 ,
66
68
sample_rate = 0.5 ,
69
+ query = f"environment:prod{ env_idx } " ,
67
70
)
68
71
69
72
rule_ids = set ()
@@ -116,6 +119,7 @@ def create_rule(is_old: bool, idx: int):
116
119
organization_id = self .organization .id ,
117
120
num_samples = 100 ,
118
121
sample_rate = 0.5 ,
122
+ query = f"environment:prod{ idx } " ,
119
123
)
120
124
121
125
for i in range (10 ):
@@ -160,6 +164,7 @@ def test_get_rule_for_org(self):
160
164
organization_id = self .organization .id ,
161
165
num_samples = 100 ,
162
166
sample_rate = 0.5 ,
167
+ query = "environment:prod" ,
163
168
)
164
169
165
170
rule = CustomDynamicSamplingRule .get_rule_for_org (
@@ -204,6 +209,7 @@ def create_rule(
204
209
organization_id = org_id ,
205
210
num_samples = 100 ,
206
211
sample_rate = 0.5 ,
212
+ query = f"environment:prod{ idx [0 ]} " ,
207
213
)
208
214
209
215
valid_project_rule = create_rule ([self .project .id , self .second_project .id ])
@@ -243,6 +249,7 @@ def test_separate_projects_create_different_rules(self):
243
249
organization_id = self .organization .id ,
244
250
num_samples = 100 ,
245
251
sample_rate = 0.5 ,
252
+ query = "environment:prod" ,
246
253
)
247
254
248
255
end2 = timezone .now () + timedelta (hours = 1 )
@@ -254,6 +261,7 @@ def test_separate_projects_create_different_rules(self):
254
261
organization_id = self .organization .id ,
255
262
num_samples = 100 ,
256
263
sample_rate = 0.5 ,
264
+ query = "environment:prod" ,
257
265
)
258
266
259
267
assert rule .id != second_rule .id
0 commit comments