1+ import random
2+
13from sentry .notifications .platform .rollout import NotificationRolloutService
24from sentry .notifications .platform .templates .types import NotificationTemplateSource
35from sentry .testutils .cases import TestCase
@@ -9,6 +11,7 @@ class NotificationRolloutServiceTest(TestCase):
911 def setUp (self ) -> None :
1012 super ().setUp ()
1113 self .organization = self .create_organization ()
14+ random .seed (0 )
1215
1316 def test_no_feature_flags_enabled (self ) -> None :
1417 service = NotificationRolloutService (organization = self .organization )
@@ -73,10 +76,7 @@ def test_unknown_option_returns_false(self) -> None:
7376 @with_feature ("organizations:notification-platform.internal-testing" )
7477 def test_partial_rollout_based_on_org_id (self ) -> None :
7578 service = NotificationRolloutService (organization = self .organization )
76- expected_result = (self .organization .id % 100 ) < 50
77- assert (
78- service .should_notify (NotificationTemplateSource .DATA_EXPORT_SUCCESS ) == expected_result
79- )
79+ assert service .should_notify (NotificationTemplateSource .DATA_EXPORT_SUCCESS )
8080
8181 def test_has_feature_flag_access_returns_none_when_no_flags (self ) -> None :
8282 service = NotificationRolloutService (organization = self .organization )
@@ -139,7 +139,5 @@ def test_multiple_sources_different_rates(self) -> None:
139139 service = NotificationRolloutService (organization = self .organization )
140140
141141 assert service .should_notify (NotificationTemplateSource .DATA_EXPORT_SUCCESS )
142- assert service .should_notify (NotificationTemplateSource .DATA_EXPORT_FAILURE ) == (
143- self .organization .id % 100 < 50
144- )
142+ assert not service .should_notify (NotificationTemplateSource .DATA_EXPORT_FAILURE )
145143 assert not service .should_notify (NotificationTemplateSource .SLOW_LOAD_METRIC_ALERT )
0 commit comments