Browse Source

ref(celery): Test celerybeat schedules so they match celery's flavour of cron (#31559)

Celerybeat schedules can and will fail during runtime if they are
configured incorrectly. This adds some testing to catch this
scenario.
relaxolotl 3 years ago
parent
commit
854beea2a8
1 changed files with 2 additions and 0 deletions
  1. 2 0
      tests/sentry/celery/test_app.py

+ 2 - 0
tests/sentry/celery/test_app.py

@@ -15,3 +15,5 @@ def test_validate_celerybeat_schedule(name, entry):
     assert entry.task in app.tasks
     mod_name = app.tasks[entry.task].__module__
     assert mod_name in settings.CELERY_IMPORTS, f"{mod_name} is missing from CELERY_IMPORTS"
+    # Test that the schedules are valid. Throws a RuntimeError if one is invalid.
+    entry.is_due()