@@ -64,7 +64,9 @@ def send_result(self, result: CheckResult):
6464
6565 def test (self ):
6666 result = self .create_uptime_result (self .subscription .subscription_id )
67- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
67+ with mock .patch (
68+ "sentry.uptime.consumers.results_consumer.metrics"
69+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
6870 self .send_result (result )
6971 metrics .incr .assert_has_calls (
7072 [
@@ -81,12 +83,33 @@ def test(self):
8183 self .project_subscription .refresh_from_db ()
8284 assert self .project_subscription .uptime_status == UptimeStatus .FAILED
8385
86+ def test_no_create_issues_feature (self ):
87+ result = self .create_uptime_result (self .subscription .subscription_id )
88+ with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
89+ self .send_result (result )
90+ metrics .incr .assert_has_calls (
91+ [
92+ call (
93+ "uptime.result_processor.handle_result_for_project" ,
94+ tags = {"status" : CHECKSTATUS_FAILURE , "mode" : "auto_detected_active" },
95+ ),
96+ ]
97+ )
98+
99+ hashed_fingerprint = md5 (str (self .project_subscription .id ).encode ("utf-8" )).hexdigest ()
100+ with pytest .raises (Group .DoesNotExist ):
101+ Group .objects .get (grouphash__hash = hashed_fingerprint )
102+ self .project_subscription .refresh_from_db ()
103+ assert self .project_subscription .uptime_status == UptimeStatus .FAILED
104+
84105 def test_resolve (self ):
85106 result = self .create_uptime_result (
86107 self .subscription .subscription_id ,
87108 scheduled_check_time = datetime .now () - timedelta (minutes = 5 ),
88109 )
89- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
110+ with mock .patch (
111+ "sentry.uptime.consumers.results_consumer.metrics"
112+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
90113 self .send_result (result )
91114 metrics .incr .assert_has_calls (
92115 [
@@ -109,7 +132,9 @@ def test_resolve(self):
109132 status = CHECKSTATUS_SUCCESS ,
110133 scheduled_check_time = datetime .now () - timedelta (minutes = 4 ),
111134 )
112- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
135+ with mock .patch (
136+ "sentry.uptime.consumers.results_consumer.metrics"
137+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
113138 self .send_result (result )
114139 metrics .incr .assert_has_calls (
115140 [
@@ -127,7 +152,9 @@ def test_resolve(self):
127152 def test_no_subscription (self ):
128153 subscription_id = uuid .uuid4 ().hex
129154 result = self .create_uptime_result (subscription_id )
130- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
155+ with mock .patch (
156+ "sentry.uptime.consumers.results_consumer.metrics"
157+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
131158 self .send_result (result )
132159 metrics .incr .assert_has_calls ([call ("uptime.result_processor.subscription_not_found" )])
133160
@@ -137,7 +164,9 @@ def test_skip_already_processed(self):
137164 build_last_update_key (self .project_subscription ),
138165 int (result ["scheduled_check_time_ms" ]),
139166 )
140- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
167+ with mock .patch (
168+ "sentry.uptime.consumers.results_consumer.metrics"
169+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
141170 self .send_result (result )
142171 metrics .incr .assert_has_calls (
143172 [
@@ -163,6 +192,7 @@ def test_missed(self):
163192 with (
164193 mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics ,
165194 mock .patch ("sentry.uptime.consumers.results_consumer.logger" ) as logger ,
195+ self .feature ("organizations:uptime-create-issues" ),
166196 ):
167197 self .send_result (result )
168198 metrics .incr .assert_called_once_with (
@@ -189,7 +219,9 @@ def test_onboarding_failure(self):
189219 redis = _get_cluster ()
190220 key = build_onboarding_failure_key (self .project_subscription )
191221 assert redis .get (key ) is None
192- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
222+ with mock .patch (
223+ "sentry.uptime.consumers.results_consumer.metrics"
224+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
193225 self .send_result (result )
194226 metrics .incr .assert_has_calls (
195227 [
@@ -216,6 +248,7 @@ def test_onboarding_failure(self):
216248 "sentry.uptime.consumers.results_consumer.ONBOARDING_FAILURE_THRESHOLD" , new = 2
217249 ),
218250 self .tasks (),
251+ self .feature ("organizations:uptime-create-issues" ),
219252 ):
220253 self .send_result (result )
221254 metrics .incr .assert_has_calls (
@@ -251,7 +284,9 @@ def test_onboarding_success_ongoing(self):
251284 redis = _get_cluster ()
252285 key = build_onboarding_failure_key (self .project_subscription )
253286 assert redis .get (key ) is None
254- with mock .patch ("sentry.uptime.consumers.results_consumer.metrics" ) as metrics :
287+ with mock .patch (
288+ "sentry.uptime.consumers.results_consumer.metrics"
289+ ) as metrics , self .feature ("organizations:uptime-create-issues" ):
255290 self .send_result (result )
256291 metrics .incr .assert_has_calls (
257292 [
@@ -284,7 +319,7 @@ def test_onboarding_success_graduate(self):
284319 assert redis .get (key ) is None
285320 with mock .patch (
286321 "sentry.uptime.consumers.results_consumer.metrics"
287- ) as metrics , self .tasks ():
322+ ) as metrics , self .tasks (), self . feature ( "organizations:uptime-create-issues" ) :
288323 self .send_result (result )
289324 metrics .incr .assert_has_calls (
290325 [
0 commit comments