@@ -241,7 +241,11 @@ def transition_to_new_config(self, new_config):
241
241
"sentry:secondary_grouping_expiry" , time .time () + (24 * 90 * 3600 )
242
242
)
243
243
244
- def test_applies_secondary_grouping_hierarchical (self ):
244
+ def test_can_upgrade_to_hierarchical_config (self ):
245
+ hierarchical_hashes = [
246
+ "be778d6d6543432ae89b3e0f94ebff80" ,
247
+ "4e536cc423da0e1e2101b30688aab6b1" ,
248
+ ]
245
249
self .set_options ("legacy:2019-03-12" ) # Starting configuration
246
250
event = self .save_event ()
247
251
assert event .get_hashes ().hashes == ["8b1a9953c4611296a827abf8c47804d7" ]
@@ -250,10 +254,6 @@ def test_applies_secondary_grouping_hierarchical(self):
250
254
self .transition_to_new_config ("mobile:2021-02-12" )
251
255
# This event will have two sets of hashes
252
256
event2 = self .save_event ()
253
- hierarchical_hashes = [
254
- "be778d6d6543432ae89b3e0f94ebff80" ,
255
- "4e536cc423da0e1e2101b30688aab6b1" ,
256
- ]
257
257
# The hashes propery gets the last hierarchical hash assigned
258
258
assert event2 .get_hashes ().hashes == [hierarchical_hashes [- 1 ]]
259
259
assert event2 .get_hashes ().hierarchical_hashes == hierarchical_hashes
@@ -272,15 +272,26 @@ def test_applies_secondary_grouping_hierarchical(self):
272
272
event3 = self .save_event ()
273
273
assert event3 .group_id == event2 .group_id
274
274
275
- def test_applies_downgrade_hierarchical (self ):
276
- self .set_options ("mobile:2021-02-12" )
275
+ def test_can_downgrade_from_hierarchical_config (self ):
276
+ hierarchical_hashes = [
277
+ "be778d6d6543432ae89b3e0f94ebff80" ,
278
+ "4e536cc423da0e1e2101b30688aab6b1" ,
279
+ ]
280
+ self .set_options ("mobile:2021-02-12" ) # Starting configuration
277
281
event = self .save_event ()
282
+ assert event .get_hashes ().hashes == ["4e536cc423da0e1e2101b30688aab6b1" ]
283
+ assert event .get_hashes ().hierarchical_hashes == hierarchical_hashes
284
+
278
285
self .transition_to_new_config ("legacy:2019-03-12" )
279
- # Switching to newstyle grouping changes hashes as 123 will be removed
286
+ # This event will have two sets of hashes
280
287
event2 = self .save_event ()
281
288
282
- # make sure that events did get into same group because of fallback grouping, not because of hashes which come from primary grouping only
289
+ # The hashes propery gets the last hierarchical hash assigned
290
+ assert event2 .get_hashes ().hashes == ["8b1a9953c4611296a827abf8c47804d7" ]
291
+ assert event2 .get_hashes ().hierarchical_hashes == []
292
+ # The hashes property between the two events do not intersect
283
293
assert not set (event .get_hashes ().hashes ) & set (event2 .get_hashes ().hashes )
294
+ # They both belong to the same group be
284
295
assert event .group_id == event2 .group_id
285
296
286
297
group = Group .objects .get (id = event .group_id )
0 commit comments