From 70c9bc93d6eff7700ea81f288bf9e8ee2f3601bd Mon Sep 17 00:00:00 2001 From: Satheesh Rajendran Date: Fri, 18 Feb 2022 19:06:59 +0530 Subject: [PATCH] Handle runtime runbook,app name changes to DSL file (#124) * Handle runtime runbook,app name changes to DSL file Handle runtime runbook,app name changes to DSL file Fixes: c68c04854c6a80ffe088a0ea6f67963d4a674652 * Fix format issue reported by black Fix format issue reported by black (cherry picked from commit ae81e0bd73515af9820dcb75a1e2da16a0e37736) --- tests/cli/test_scheduler_commands.py | 108 ++++++++++++------ .../execution_time_invalid_onetime.py | 4 +- .../expiry_less_currentdate_recurring.py | 5 +- tests/scheduler/invalid_cron_recurring.py | 4 +- tests/scheduler/invalid_end_date_recurring.py | 4 +- tests/scheduler/invalid_schedule_recurring.py | 4 +- tests/scheduler/job_app_action_onetime.py | 6 +- tests/scheduler/job_app_action_recc.py | 8 +- tests/scheduler/job_create_blank_name.py | 4 +- tests/scheduler/job_create_duplicate_name.py | 4 +- tests/scheduler/job_create_one_time.py | 4 +- tests/scheduler/job_create_recurring.py | 4 +- tests/scheduler/job_describe.py | 4 +- tests/scheduler/job_list.py | 4 +- .../job_recurring_every_two_minute.py | 4 +- ...ecurring_every_two_minute_decision_task.py | 6 +- tests/scheduler/job_unicode.py | 4 +- tests/scheduler/one_time_scheduler.py | 4 +- .../one_time_scheduler_decision_task.py | 4 +- .../start_greater_expiry_date_recurring.py | 4 +- 20 files changed, 133 insertions(+), 60 deletions(-) diff --git a/tests/cli/test_scheduler_commands.py b/tests/cli/test_scheduler_commands.py index c330e5c8..c18f084e 100644 --- a/tests/cli/test_scheduler_commands.py +++ b/tests/cli/test_scheduler_commands.py @@ -2,6 +2,7 @@ import time import uuid import pytest +import re import os as os_lib from distutils.version import LooseVersion as LV @@ -44,6 +45,16 @@ def suffix(length=8): return str(uuid.uuid4())[:length] +def file_replace(filename, match_str, replace_str): + """Replaces given match_str with replace_str in file with filename""" + with open(filename, "r") as fd: + filecontent = fd.read() + + newcontent = re.sub(match_str, replace_str, filecontent) + with open(filename, "w") as fd: + fd.write(newcontent) + + @pytest.mark.skipif( LV(CALM_VERSION) < LV("3.4.0"), reason="Scheduler FEAT is for v3.4.0" ) @@ -67,12 +78,16 @@ def test_job_create_app_action(self, dsl_file): bp_file = os_lib.path.dirname(current_path) + "/scheduler/" + DSL_BP_FILE client = get_api_client() bps.create_blueprint_from_dsl(client, bp_file, bp_name, force_create=True) + app_name = "{}_{}".format(bp_name, suffix()) # Launch Blueprint - bps.launch_blueprint_simple( - bp_name, app_name="{}_{}".format(bp_name, suffix()), patch_editables=False - ) + bps.launch_blueprint_simple(bp_name, app_name=app_name, patch_editables=False) jobname = "test_job_scheduler" + suffix() + file_replace( + dsl_file, + r'"{}.*\n'.format(dsl_file_name[: dsl_file_name.find(".")]), + r'"{}"\n'.format(app_name), + ) result = scheduler.create_job_command(dsl_file, jobname, None, False) assert result.get("resources").get("state") == "ACTIVE" @@ -108,17 +123,20 @@ def test_job_create_runbook(self, dsl_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True + ) + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), ) - result = scheduler.create_job_command(dsl_file, None, None, False) LOG.info(result) assert result.get("resources").get("state") == "ACTIVE" @@ -135,17 +153,20 @@ def test_invalid_job_create_runbook(self, dsl_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True + ) + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), ) - result = scheduler.create_job_command(dsl_file, None, None, False) LOG.info(result) assert result.get("resources").get("state") == "INACTIVE" @@ -193,18 +214,22 @@ def test_job_create_duplicate_name(self, dsl_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True ) jobname = "duplicate_name_check" + suffix() # Create first job. + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), + ) result = scheduler.create_job_command(dsl_file, jobname, None, False) LOG.info(result) assert result.get("resources").get("state") == "ACTIVE" @@ -234,17 +259,20 @@ def test_job_name_blank(self, dsl_file): # Create runbook dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True + ) + file_replace( + dsl_file, + r"{}.*\n".format(runbook_name), + '{}"\n'.format(runbook_name_suffixed), ) - result = _create_job_with_custom_name(dsl_file) assert result.get("resources").get("state") == "INACTIVE" msg_list = result.get("resources").get("message_list", []) @@ -266,18 +294,22 @@ def test_job_list(self, dsl_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True ) job_name = "test_job_list_" + suffix() + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), + ) result = _create_job_with_custom_name(dsl_file, job_name) LOG.info(result) assert result.get("resources").get("state") == "ACTIVE" @@ -303,17 +335,21 @@ def test_job_describe(self, dsl_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + DSL_RUNBOOK_FILE ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True ) job_name = "test_job_describe_" + suffix() + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), + ) result = _create_job_with_custom_name(dsl_file, job_name) LOG.info(result) assert result.get("resources").get("state") == "ACTIVE" @@ -345,17 +381,21 @@ def test_job_scheduler(self, dsl_file, dsl_runbook_file): # Create runbook current_path = os_lib.path.dirname(os_lib.path.realpath(__file__)) dsl_file_name_for_runbook = dsl_file[dsl_file.rfind("/") :].replace("/", "") - runbook_name = "{}_{}".format( - dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")], suffix() - ) + runbook_name = dsl_file_name_for_runbook[: dsl_file_name_for_runbook.find(".")] + runbook_name_suffixed = "{}_{}".format(runbook_name, suffix()) runbook_file = ( os_lib.path.dirname(current_path) + "/scheduler/" + dsl_runbook_file ) runbooks.create_runbook_command( - runbook_file, runbook_name, description="", force=True + runbook_file, runbook_name_suffixed, description="", force=True ) jobname = "test_job_scheduler" + suffix() + file_replace( + dsl_file, + r'"{}.*\n'.format(runbook_name), + r'"{}"\n'.format(runbook_name_suffixed), + ) result = scheduler.create_job_command(dsl_file, jobname, None, False) assert result.get("resources").get("state") == "ACTIVE" diff --git a/tests/scheduler/execution_time_invalid_onetime.py b/tests/scheduler/execution_time_invalid_onetime.py index e2cc53db..25cd4345 100644 --- a/tests/scheduler/execution_time_invalid_onetime.py +++ b/tests/scheduler/execution_time_invalid_onetime.py @@ -6,10 +6,12 @@ start_date_time = "2020-10-08 16:17:15" time_zone = "America/Jamaica" +RUNBOOK_NAME = "execution_time_invalid_onetime" + class JobOneTimeSpec(Job): """One Time Invalid Job for Executing a Runbook with execution date less than current date""" name = "test_job_" + str(uuid.uuid4())[:8] schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date_time, time_zone) - executable = JobScheduler.Exec.runbook("execution_time_invalid_onetime", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/expiry_less_currentdate_recurring.py b/tests/scheduler/expiry_less_currentdate_recurring.py index 7617a044..9b33e390 100644 --- a/tests/scheduler/expiry_less_currentdate_recurring.py +++ b/tests/scheduler/expiry_less_currentdate_recurring.py @@ -17,6 +17,9 @@ expiry_time = str(expiry_time.strftime("%Y-%m-%dT%H:%M:%SZ")) +RUNBOOK_NAME = "expiry_less_currentdate_recurring" + + class JobInvalidRecurringSpec(Job): """Recurring Invalid Job for Executing a Runbook with expiry date less than current date""" @@ -24,4 +27,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("expiry_less_currentdate_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/invalid_cron_recurring.py b/tests/scheduler/invalid_cron_recurring.py index 9e0432c0..56b9750c 100644 --- a/tests/scheduler/invalid_cron_recurring.py +++ b/tests/scheduler/invalid_cron_recurring.py @@ -8,6 +8,8 @@ cron = "15 1 32 * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "invalid_cron_recurring" + class JobInvalidRecurringSpec(Job): """Recurring Job for Executing a Runbook with invalid cron""" @@ -16,4 +18,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("invalid_cron_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/invalid_end_date_recurring.py b/tests/scheduler/invalid_end_date_recurring.py index eab90b18..593d450e 100644 --- a/tests/scheduler/invalid_end_date_recurring.py +++ b/tests/scheduler/invalid_end_date_recurring.py @@ -8,6 +8,8 @@ cron = "52 15 * * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "invalid_end_date_recurring" + class JobInvalidRecurringSpec(Job): """Recurring Invalid Job for Executing a Runbook with End date less than Current date""" @@ -16,4 +18,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("invalid_end_date_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/invalid_schedule_recurring.py b/tests/scheduler/invalid_schedule_recurring.py index a56359b4..87b1ad99 100644 --- a/tests/scheduler/invalid_schedule_recurring.py +++ b/tests/scheduler/invalid_schedule_recurring.py @@ -8,6 +8,8 @@ cron = "52 15 * * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "invalid_schedule_recurring" + class JobInvalidRecurringSpec(Job): """Recurring Invalid Job for Executing a Runbook with start date less than current date""" @@ -16,4 +18,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("invalid_schedule_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_app_action_onetime.py b/tests/scheduler/job_app_action_onetime.py index 205bb9e7..0f2589c2 100644 --- a/tests/scheduler/job_app_action_onetime.py +++ b/tests/scheduler/job_app_action_onetime.py @@ -10,11 +10,11 @@ time_zone = "Asia/Kolkata" +APP_NAME = "job_app_action_onetime" + class JobOneTimeSpec(Job): """One Time Job for Executing an App Action""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date, time_zone) - executable = JobScheduler.Exec.app_action( - "job_app_action_onetime", "sample_profile_action" - ) + executable = JobScheduler.Exec.app_action(APP_NAME, "sample_profile_action") diff --git a/tests/scheduler/job_app_action_recc.py b/tests/scheduler/job_app_action_recc.py index 7140050c..55c14264 100644 --- a/tests/scheduler/job_app_action_recc.py +++ b/tests/scheduler/job_app_action_recc.py @@ -15,14 +15,14 @@ time_zone = "Asia/Kolkata" +APP_NAME = "job_app_action_recc" + class JobRecurring(Job): """Recurring Job for Executing an App Action""" - name = "job_app_action_recc" + name = "test_job_app_action_recc" schedule_info = JobScheduler.ScheduleInfo.recurring( "*/2 * * * *", start_date, expiry_date, time_zone ) - executable = JobScheduler.Exec.app_action( - "job_app_action_recc", "sample_profile_action" - ) + executable = JobScheduler.Exec.app_action(APP_NAME, "sample_profile_action") diff --git a/tests/scheduler/job_create_blank_name.py b/tests/scheduler/job_create_blank_name.py index 49655aba..04fdbbca 100644 --- a/tests/scheduler/job_create_blank_name.py +++ b/tests/scheduler/job_create_blank_name.py @@ -4,9 +4,11 @@ start_date_time = "2050-10-08 16:17:15" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_create_blank_name" + class JobOneTimeBlankNameSpec(Job): """One Time Job for Executing a Runbook""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date_time, time_zone) - executable = JobScheduler.Exec.runbook("job_create_blank_name", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_create_duplicate_name.py b/tests/scheduler/job_create_duplicate_name.py index f07eb9d2..919e9e7a 100644 --- a/tests/scheduler/job_create_duplicate_name.py +++ b/tests/scheduler/job_create_duplicate_name.py @@ -4,9 +4,11 @@ start_date_time = "2050-10-08 16:17:15" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_create_duplicate_name" + class JobOneTimeDuplicateNameSpec(Job): """One Time Job for Executing a Runbook""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date_time, time_zone) - executable = JobScheduler.Exec.runbook("job_create_duplicate_name", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_create_one_time.py b/tests/scheduler/job_create_one_time.py index d896f1cf..3aedec9e 100644 --- a/tests/scheduler/job_create_one_time.py +++ b/tests/scheduler/job_create_one_time.py @@ -6,10 +6,12 @@ start_date_time = "2050-10-08 16:17:15" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_create_one_time" + class JobOneTimeSpec(Job): """One Time Job for Executing a Runbook""" name = "test_job" + str(uuid.uuid4())[:8] schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date_time, time_zone) - executable = JobScheduler.Exec.runbook("job_create_one_time", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_create_recurring.py b/tests/scheduler/job_create_recurring.py index 5edc3f8a..fcc42d33 100644 --- a/tests/scheduler/job_create_recurring.py +++ b/tests/scheduler/job_create_recurring.py @@ -7,6 +7,8 @@ cron = "52 15 * * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_create_recurring" + class JobRecurringSpec(Job): """Recurring Job for Executing a Runbook""" @@ -15,4 +17,4 @@ class JobRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("job_create_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_describe.py b/tests/scheduler/job_describe.py index fe92c45e..c27b5cdc 100644 --- a/tests/scheduler/job_describe.py +++ b/tests/scheduler/job_describe.py @@ -6,6 +6,8 @@ cron = "15 1 1 * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_describe" + class JobRecurringSpec(Job): """Recurring Job for Executing a Runbook""" @@ -13,4 +15,4 @@ class JobRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("job_describe", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_list.py b/tests/scheduler/job_list.py index 34b13a69..317c1044 100644 --- a/tests/scheduler/job_list.py +++ b/tests/scheduler/job_list.py @@ -4,9 +4,11 @@ start_date_time = "2050-10-08 16:17:15" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_list" + class JobOneTimeListSpec(Job): """One Time Job for Executing a Runbook""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date_time, time_zone) - executable = JobScheduler.Exec.runbook("job_list", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_recurring_every_two_minute.py b/tests/scheduler/job_recurring_every_two_minute.py index e22a8fa4..84d26722 100644 --- a/tests/scheduler/job_recurring_every_two_minute.py +++ b/tests/scheduler/job_recurring_every_two_minute.py @@ -17,6 +17,8 @@ time_zone = "Asia/Kolkata" +RUNBOOK_NAME = "job_recurring_every_two_minute" + class JobRecurring(Job): """Recurring Job for Executing a Runbook""" @@ -24,4 +26,4 @@ class JobRecurring(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( "*/2 * * * *", start_date, expiry_date, time_zone ) - executable = JobScheduler.Exec.runbook("job_recurring_every_two_minute", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_recurring_every_two_minute_decision_task.py b/tests/scheduler/job_recurring_every_two_minute_decision_task.py index 87e8d160..9a328980 100644 --- a/tests/scheduler/job_recurring_every_two_minute_decision_task.py +++ b/tests/scheduler/job_recurring_every_two_minute_decision_task.py @@ -15,6 +15,8 @@ time_zone = "Asia/Kolkata" +RUNBOOK_NAME = "job_recurring_every_two_minute_decision_task" + class JobRecurring(Job): """Recurring Job for Executing a Runbook""" @@ -22,6 +24,4 @@ class JobRecurring(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( "*/2 * * * *", start_date, expiry_date, time_zone ) - executable = JobScheduler.Exec.runbook( - "job_recurring_every_two_minute_decision_task", False - ) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/job_unicode.py b/tests/scheduler/job_unicode.py index 97b23005..4e1c0626 100644 --- a/tests/scheduler/job_unicode.py +++ b/tests/scheduler/job_unicode.py @@ -9,6 +9,8 @@ cron = "52 15 * * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "job_unicode" + class JobInvalidRecurringSpec(Job): """Recurring Job with Unicode кызмат""" @@ -17,4 +19,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("job_unicode", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/one_time_scheduler.py b/tests/scheduler/one_time_scheduler.py index c6c63b8d..44ab6809 100644 --- a/tests/scheduler/one_time_scheduler.py +++ b/tests/scheduler/one_time_scheduler.py @@ -9,9 +9,11 @@ ) time_zone = "Asia/Kolkata" +RUNBOOK_NAME = "one_time_scheduler" + class JobOneTimeSpec(Job): """One Time Job for Executing a Runbook""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date, time_zone) - executable = JobScheduler.Exec.runbook("one_time_scheduler", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/one_time_scheduler_decision_task.py b/tests/scheduler/one_time_scheduler_decision_task.py index fb762205..a11d3ed7 100644 --- a/tests/scheduler/one_time_scheduler_decision_task.py +++ b/tests/scheduler/one_time_scheduler_decision_task.py @@ -10,9 +10,11 @@ time_zone = "Asia/Kolkata" +RUNBOOK_NAME = "one_time_scheduler_decision_task" + class JobOneTimeSpec(Job): """One Time Job for Executing a Runbook""" schedule_info = JobScheduler.ScheduleInfo.oneTime(start_date, time_zone) - executable = JobScheduler.Exec.runbook("one_time_scheduler_decision_task", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False) diff --git a/tests/scheduler/start_greater_expiry_date_recurring.py b/tests/scheduler/start_greater_expiry_date_recurring.py index c0589a88..75964c94 100644 --- a/tests/scheduler/start_greater_expiry_date_recurring.py +++ b/tests/scheduler/start_greater_expiry_date_recurring.py @@ -8,6 +8,8 @@ cron = "52 15 * * *" time_zone = "America/Jamaica" +RUNBOOK_NAME = "start_greater_expiry_date_recurring" + class JobInvalidRecurringSpec(Job): """Recurring Invalid Job for Executing a Runbook with start date greater than expiry date""" @@ -16,4 +18,4 @@ class JobInvalidRecurringSpec(Job): schedule_info = JobScheduler.ScheduleInfo.recurring( cron, start_date_time, expiry_date_time, time_zone ) - executable = JobScheduler.Exec.runbook("start_greater_expiry_date_recurring", False) + executable = JobScheduler.Exec.runbook(RUNBOOK_NAME, False)