Skip to content

Commit c5e0cb2

Browse files
committed
re-add the RuleModel code to see if that will help these other failing tests for now, start updating tests that are failing because of the logic change
1 parent 00ff211 commit c5e0cb2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/sentry/workflow_engine/receivers/project_workflows.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@
3939
def create_default_rules(
4040
project: Project,
4141
default_rules: bool = False,
42+
RuleModel: type[Rule] = Rule,
4243
**kwargs: Any,
4344
) -> None:
4445
rule_data = DEFAULT_RULE_DATA
4546

4647
if not default_rules:
4748
return
4849

49-
with transaction.atomic(router.db_for_write(Rule)):
50-
rule = Rule.objects.create(
50+
with transaction.atomic(router.db_for_write(RuleModel)):
51+
rule = RuleModel.objects.create(
5152
project=project,
5253
label=DEFAULT_RULE_LABEL,
5354
data=rule_data,

tests/sentry/receivers/test_onboarding.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ def test_project_created__default_workflow(self) -> None:
175175

176176
assert Detector.objects.filter(project=project, type=ErrorGroupType.slug).count() == 1
177177
assert Detector.objects.filter(project=project, type=IssueStreamGroupType.slug).count() == 1
178-
assert DetectorWorkflow.objects.filter(workflow=workflow).count() == 2
178+
179+
# Ensuer we have 1 connection to the issue stream, this triggers for both monitors above.
180+
result_connection = DetectorWorkflow.objects.filter(workflow=workflow)
181+
assert result_connection.count() == 1
182+
assert result_connection[0].type == IssueStreamGroupType.slug
179183

180184
@patch("sentry.analytics.record", wraps=record)
181185
def test_project_created_with_origin(self, record_analytics: MagicMock) -> None:

0 commit comments

Comments
 (0)