@@ -213,7 +213,7 @@ def test_get_monitor_config_crontab():
213
213
app .conf .timezone = "Europe/Vienna"
214
214
215
215
celery_schedule = crontab (day_of_month = "3" , hour = "12" , minute = "*/10" )
216
- monitor_config = _get_monitor_config (celery_schedule , app )
216
+ monitor_config = _get_monitor_config (celery_schedule , app , "foo" )
217
217
assert monitor_config == {
218
218
"schedule" : {
219
219
"type" : "crontab" ,
@@ -230,8 +230,17 @@ def test_get_monitor_config_seconds():
230
230
app .conf .timezone = "Europe/Vienna"
231
231
232
232
celery_schedule = schedule (run_every = 3 ) # seconds
233
- monitor_config = _get_monitor_config (celery_schedule , app )
234
- assert monitor_config == {}
233
+
234
+ with mock .patch (
235
+ "sentry_sdk.integrations.celery.logger.warning"
236
+ ) as mock_logger_warning :
237
+ monitor_config = _get_monitor_config (celery_schedule , app , "foo" )
238
+ mock_logger_warning .assert_called_with (
239
+ "Intervals shorter than one minute are not supported by Sentry Crons. Monitor '%s' has an interval of %s seconds. Use the `exclude_beat_tasks` option in the celery integration to exclude it." ,
240
+ "foo" ,
241
+ 3 ,
242
+ )
243
+ assert monitor_config == {}
235
244
236
245
237
246
def test_get_monitor_config_minutes ():
@@ -240,7 +249,7 @@ def test_get_monitor_config_minutes():
240
249
app .conf .timezone = "Europe/Vienna"
241
250
242
251
celery_schedule = schedule (run_every = 60 ) # seconds
243
- monitor_config = _get_monitor_config (celery_schedule , app )
252
+ monitor_config = _get_monitor_config (celery_schedule , app , "foo" )
244
253
assert monitor_config == {
245
254
"schedule" : {
246
255
"type" : "interval" ,
@@ -257,7 +266,7 @@ def test_get_monitor_config_unknown():
257
266
app .conf .timezone = "Europe/Vienna"
258
267
259
268
unknown_celery_schedule = MagicMock ()
260
- monitor_config = _get_monitor_config (unknown_celery_schedule , app )
269
+ monitor_config = _get_monitor_config (unknown_celery_schedule , app , "foo" )
261
270
assert monitor_config == {}
262
271
263
272
@@ -268,7 +277,7 @@ def test_get_monitor_config_default_timezone():
268
277
269
278
celery_schedule = crontab (day_of_month = "3" , hour = "12" , minute = "*/10" )
270
279
271
- monitor_config = _get_monitor_config (celery_schedule , app )
280
+ monitor_config = _get_monitor_config (celery_schedule , app , "foo" )
272
281
273
282
assert monitor_config ["timezone" ] == "UTC"
274
283
0 commit comments