diff --git a/src/sentry/backup/comparators.py b/src/sentry/backup/comparators.py index 9155f6de851d3f..cb4c6e2f21d8e5 100644 --- a/src/sentry/backup/comparators.py +++ b/src/sentry/backup/comparators.py @@ -865,6 +865,7 @@ def get_default_comparators() -> dict[str, list[JSONScrubbingComparator]]: ], "sentry.userrole": [DateUpdatedComparator("date_updated")], "sentry.userroleuser": [DateUpdatedComparator("date_updated")], + "workflow_engine.datacondition": [DateUpdatedComparator("date_updated", "date_added")], "workflow_engine.datasource": [DateUpdatedComparator("date_updated", "date_added")], "workflow_engine.datasourcedetector": [ DateUpdatedComparator("date_updated", "date_added") diff --git a/src/sentry/testutils/factories.py b/src/sentry/testutils/factories.py index 280b01504377ea..1c137ee9fa7fe4 100644 --- a/src/sentry/testutils/factories.py +++ b/src/sentry/testutils/factories.py @@ -171,6 +171,7 @@ from sentry.utils import loremipsum from sentry.utils.performance_issues.performance_problem import PerformanceProblem from sentry.workflow_engine.models import ( + DataCondition, DataSource, DataSourceDetector, Detector, @@ -2059,7 +2060,7 @@ def create_workflow( @staticmethod @assume_test_silo_mode(SiloMode.REGION) - def create_workflowaction( + def create_workflow_action( workflow: Workflow | None = None, **kwargs, ) -> WorkflowAction: @@ -2067,6 +2068,13 @@ def create_workflowaction( workflow = Factories.create_workflow() return WorkflowAction.objects.create(workflow=workflow, **kwargs) + @staticmethod + @assume_test_silo_mode(SiloMode.REGION) + def create_data_condition( + **kwargs, + ) -> DataCondition: + return DataCondition.objects.create(**kwargs) + @staticmethod @assume_test_silo_mode(SiloMode.REGION) def create_data_source( diff --git a/src/sentry/testutils/fixtures.py b/src/sentry/testutils/fixtures.py index d0242c1dc522ed..3655bb25052586 100644 --- a/src/sentry/testutils/fixtures.py +++ b/src/sentry/testutils/fixtures.py @@ -43,6 +43,7 @@ from sentry.users.models.identity import Identity, IdentityProvider from sentry.users.models.user import User from sentry.users.services.user import RpcUser +from sentry.workflow_engine.models import DataSource, Detector, Workflow class Fixtures: @@ -633,16 +634,19 @@ def create_dashboard_widget(self, *args, **kwargs): def create_dashboard_widget_query(self, *args, **kwargs): return Factories.create_dashboard_widget_query(*args, **kwargs) - def create_workflow(self, *args, **kwargs): + def create_workflow(self, *args, **kwargs) -> Workflow: return Factories.create_workflow(*args, **kwargs) - def create_workflowaction(self, *args, **kwargs): - return Factories.create_workflowaction(*args, **kwargs) + def create_workflow_action(self, *args, **kwargs): + return Factories.create_workflow_action(*args, **kwargs) def create_data_source(self, *args, **kwargs): return Factories.create_data_source(*args, **kwargs) - def create_detector(self, *args, **kwargs): + def create_data_condition(self, *args, **kwargs): + return Factories.create_data_condition(*args, **kwargs) + + def create_detector(self, *args, **kwargs) -> Detector: return Factories.create_detector(*args, **kwargs) def create_data_source_detector(self, *args, **kwargs): diff --git a/src/sentry/testutils/helpers/backups.py b/src/sentry/testutils/helpers/backups.py index 6286f41da4e6c0..2753acdb50292c 100644 --- a/src/sentry/testutils/helpers/backups.py +++ b/src/sentry/testutils/helpers/backups.py @@ -610,11 +610,12 @@ def create_exhaustive_organization( workflow = self.create_workflow(organization=org) self.create_workflowaction(workflow=workflow) - self.create_workflow(organization=org) - self.create_data_source_detector( - self.create_data_source(organization=org), - self.create_detector(organization=org), - ) + detector = (self.create_detector(organization=org),) + data_source = self.create_data_source(organization=org) + + self.create_data_source_detector(data_source, detector) + self.create_workflow_action(workflow=workflow) + self.create_data_condition(detector=detector) return org