Skip to content

Commit a0e70c6

Browse files
committed
make tests run both branches of assign_event_to_group
1 parent faaf66b commit a0e70c6

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/sentry/event_manager/grouping/test_assign_to_group.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from sentry.models.grouphash import GroupHash
1818
from sentry.models.project import Project
1919
from sentry.testutils.helpers.eventprocessing import save_new_event
20+
from sentry.testutils.helpers.features import Feature
2021
from sentry.testutils.pytest.fixtures import django_db_all
2122
from sentry.testutils.pytest.mocking import capture_return_values
2223
from sentry.testutils.skips import requires_snuba
@@ -121,6 +122,7 @@ def get_results_from_saving_event(
121122
secondary_config: str,
122123
in_transition: bool,
123124
existing_group_id: int | None = None,
125+
new_logic_enabled: bool = False,
124126
):
125127
# Slightly gross (and with even grosser auto-formatting), but it saves having to do a bunch of
126128
# `x if y else None` below
@@ -138,7 +140,10 @@ def get_results_from_saving_event(
138140

139141
return_values: dict[str, list[Any]] = {}
140142

141-
with patch_grouping_helpers(return_values) as spies:
143+
with (
144+
patch_grouping_helpers(return_values) as spies,
145+
Feature({"organizations:grouping-suppress-unnecessary-secondary-hash": new_logic_enabled}),
146+
):
142147
calculate_secondary_hash_spy = spies["_calculate_secondary_hash"]
143148
create_group_spy = spies["_create_group"]
144149
calculate_primary_hash_spy = spies["_calculate_primary_hash"]
@@ -227,7 +232,13 @@ def get_results_from_saving_event(
227232
@pytest.mark.parametrize(
228233
"in_transition", (True, False), ids=(" in_transition: True ", " in_transition: False ")
229234
)
235+
@pytest.mark.parametrize(
236+
"new_logic_enabled",
237+
(True, False),
238+
ids=(" new_logic_enabled: True ", " new_logic_enabled: False "),
239+
)
230240
def test_new_group(
241+
new_logic_enabled: bool,
231242
in_transition: bool,
232243
default_project: Project,
233244
):
@@ -240,6 +251,7 @@ def test_new_group(
240251
primary_config=NEWSTYLE_CONFIG,
241252
secondary_config=LEGACY_CONFIG,
242253
in_transition=in_transition,
254+
new_logic_enabled=new_logic_enabled,
243255
)
244256

245257
if in_transition:
@@ -279,7 +291,13 @@ def test_new_group(
279291
@pytest.mark.parametrize(
280292
"in_transition", (True, False), ids=(" in_transition: True ", " in_transition: False ")
281293
)
294+
@pytest.mark.parametrize(
295+
"new_logic_enabled",
296+
(True, False),
297+
ids=(" new_logic_enabled: True ", " new_logic_enabled: False "),
298+
)
282299
def test_existing_group_no_new_hash(
300+
new_logic_enabled: bool,
283301
in_transition: bool,
284302
default_project: Project,
285303
):
@@ -297,6 +315,7 @@ def test_existing_group_no_new_hash(
297315
secondary_config=LEGACY_CONFIG,
298316
in_transition=in_transition,
299317
existing_group_id=existing_event.group_id,
318+
new_logic_enabled=new_logic_enabled,
300319
)
301320

302321
if in_transition:
@@ -334,13 +353,19 @@ def test_existing_group_no_new_hash(
334353
@pytest.mark.parametrize(
335354
"in_transition", (True, False), ids=(" in_transition: True ", " in_transition: False ")
336355
)
356+
@pytest.mark.parametrize(
357+
"new_logic_enabled",
358+
(True, False),
359+
ids=(" new_logic_enabled: True ", " new_logic_enabled: False "),
360+
)
337361
@pytest.mark.parametrize(
338362
"secondary_hash_exists",
339363
(True, False),
340364
ids=(" secondary_hash_exists: True ", " secondary_hash_exists: False "),
341365
)
342366
def test_existing_group_new_hash_exists(
343367
secondary_hash_exists: bool,
368+
new_logic_enabled: bool,
344369
in_transition: bool,
345370
default_project: Project,
346371
):
@@ -375,6 +400,7 @@ def test_existing_group_new_hash_exists(
375400
secondary_config=LEGACY_CONFIG,
376401
in_transition=in_transition,
377402
existing_group_id=existing_event.group_id,
403+
new_logic_enabled=new_logic_enabled,
378404
)
379405

380406
if in_transition:

0 commit comments

Comments
 (0)