Example #1
0
def test_build_celery_crontab_schedule():
    cron_schedule = "2 * * * *"
    assert crontab(minute="2",
                   hour="*",
                   day_of_week="*",
                   day_of_month="*",
                   month_of_year="*") == build_celery_schedule(
                       "workflow_cron_schedule1", cron_schedule)

    cron_schedule = "* * */15 * *"
    assert crontab(minute="*",
                   hour="*",
                   day_of_week="*/15",
                   day_of_month="*",
                   month_of_year="*") == build_celery_schedule(
                       "workflow_cron_schedule1", cron_schedule)
Example #2
0
def test_build_celery_invalid_periodic_key():
    cron_schedule = {"non_valid_key": "* * * * *"}
    with pytest.raises(WorkflowSyntaxError):
        build_celery_schedule("workflow_invalid_key", cron_schedule)
Example #3
0
def test_build_celery_invalid_schedule():
    cron_schedule = {"crontab": "* * * * 12"}
    with pytest.raises(WorkflowSyntaxError):
        build_celery_schedule("workflow_invalid_crontab", cron_schedule)
Example #4
0
def test_build_celery_invalid_crontab():
    # missing one element on the crontab syntax
    periodic_conf = {"crontab": "* * * *"}
    with pytest.raises(WorkflowSyntaxError):
        build_celery_schedule("workflow_invalid_crontab", periodic_conf)
Example #5
0
def test_build_celery_crontab(test_input, expected):
    cron_schedule = {"crontab": test_input}
    assert (test_input,
            expected) == build_celery_schedule("workflow_crontab",
                                               cron_schedule)
Example #6
0
def test_build_celery_interval():
    float_schedule = {"interval": 30.0}
    assert ("30.0", 30.0) == build_celery_schedule("workflow_schedule_float",
                                                   float_schedule)
Example #7
0
def test_build_celery_schedule_float_with_payload():
    float_schedule = {"payload": {}, "schedule": 30.0}
    assert ("30.0", 30.0) == build_celery_schedule("workflow_schedule_float",
                                                   float_schedule)
Example #8
0
def test_workflow_invalid_cron():
    cron_schedule = "2 * * *"

    with pytest.raises(WorkflowSyntaxError):
        build_celery_schedule("workflow_cron_invalid_cron", cron_schedule)
Example #9
0
def test_build_celery_float_schedule():
    float_schedule = 30.0
    assert float_schedule == build_celery_schedule("workflow_int_schedule",
                                                   float_schedule)