Skip to content

Commit aff5a71

Browse files
cursoragentarmenzg
andcommitted
fix: Add CustomDynamicSamplingRule back to user merge test coverage
The CustomDynamicSamplingRule model has RelocationScope.Organization and a HybridCloudForeignKey to User via created_by_id. It was removed from the @expect_models decorators and model_list, but the model still exists and needs to be included in user merge coverage to pass the test_all_eligible_organization_scoped_models_tested_for_user_merge test. This fix: 1. Adds CustomDynamicSamplingRule import and includes it in both @expect_models decorators in test_user.py 2. Sets created_by_id=owner_id when creating CustomDynamicSamplingRule in create_exhaustive_organization fixture 3. Adds CustomDynamicSamplingRule to model_list in organization impl.py for user merging Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
1 parent c4c7084 commit aff5a71

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/sentry/organizations/services/organization/impl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from sentry.incidents.models.incident import IncidentActivity
2121
from sentry.models.activity import Activity
2222
from sentry.models.dashboard import Dashboard, DashboardFavoriteUser
23+
from sentry.models.dynamicsampling import CustomDynamicSamplingRule
2324
from sentry.models.groupassignee import GroupAssignee
2425
from sentry.models.groupbookmark import GroupBookmark
2526
from sentry.models.groupsearchview import GroupSearchView
@@ -580,6 +581,7 @@ def merge_users(self, *, organization_id: int, from_user_id: int, to_user_id: in
580581
Activity,
581582
AlertRule,
582583
AlertRuleActivity,
584+
CustomDynamicSamplingRule,
583585
Dashboard,
584586
DashboardFavoriteUser,
585587
GroupAssignee,

src/sentry/testutils/helpers/backups.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ def create_exhaustive_organization(
826826
num_samples=100,
827827
condition_hash="abc123def456abc123def456abc123def4560000",
828828
sample_rate=0.5,
829+
created_by_id=owner_id,
829830
)
830831
CustomDynamicSamplingRuleProject.objects.create(
831832
custom_dynamic_sampling_rule=custom_rule,

tests/sentry/users/models/test_user.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from sentry.models.activity import Activity
1414
from sentry.models.authidentity import AuthIdentity
1515
from sentry.models.dashboard import Dashboard, DashboardFavoriteUser
16+
from sentry.models.dynamicsampling import CustomDynamicSamplingRule
1617
from sentry.models.groupassignee import GroupAssignee
1718
from sentry.models.groupbookmark import GroupBookmark
1819
from sentry.models.groupsearchview import GroupSearchView
@@ -382,6 +383,7 @@ def test_duplicate_memberships(self, expected_models: list[type[Model]]) -> None
382383
Activity,
383384
AlertRule,
384385
AlertRuleActivity,
386+
CustomDynamicSamplingRule,
385387
Dashboard,
386388
DashboardFavoriteUser,
387389
GroupAssignee,
@@ -425,6 +427,7 @@ def test_only_source_user_is_member_of_organization(
425427
Activity,
426428
AlertRule,
427429
AlertRuleActivity,
430+
CustomDynamicSamplingRule,
428431
Dashboard,
429432
DashboardFavoriteUser,
430433
GroupAssignee,

0 commit comments

Comments
 (0)