Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/sentry/workflow_engine/defaults/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def connect_workflows_to_issue_stream(


def create_priority_workflow(org: Organization) -> Workflow:
existing = Workflow.objects.filter(organization=org, name=DEFAULT_WORKFLOW_LABEL).first()
if existing:
return existing

with transaction.atomic(router.db_for_write(Workflow)):
when_condition_group = DataConditionGroup.objects.create(
logic_type=DataConditionGroup.Type.ANY_SHORT_CIRCUIT,
Expand Down
8 changes: 4 additions & 4 deletions tests/sentry/workflow_engine/defaults/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@ def test_creates_action_filter_and_links(self) -> None:
# Verify action filter has correct logic type
assert action_filter.logic_type == DataConditionGroup.Type.ANY_SHORT_CIRCUIT

def test_idempotent_returns_existing_workflow(self) -> None:
def test_creates_separate_workflow_per_call(self) -> None:
"""Each call creates a new Workflow so that each project gets its own."""
org = self.create_organization()

workflow1 = create_priority_workflow(org)
workflow2 = create_priority_workflow(org)

assert workflow1.id == workflow2.id
# Should only have one workflow
assert workflow1.id != workflow2.id
assert (
Workflow.objects.filter(
organization=org, name="Send a notification for high priority issues"
).count()
== 1
== 2
)


Expand Down
Loading