From 039aa4a2188c318a63c6948dc939424d6513c331 Mon Sep 17 00:00:00 2001 From: Justin Haze Date: Fri, 26 Apr 2024 13:55:18 -0600 Subject: [PATCH] In tests replace logger action with test_monitor_sigan, update scos-actions branch, remove logger action from openapi.json --- docs/openapi.json | 1 - src/requirements-dev.txt | 2 +- src/requirements.txt | 2 +- src/schedule/tests/test_models.py | 42 ++++---- src/schedule/tests/test_serializers.py | 132 +++++++++++++++---------- src/schedule/tests/utils.py | 6 +- src/scheduler/tests/test_scheduler.py | 42 ++++---- 7 files changed, 130 insertions(+), 97 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 58cf9ab7..2d860ebd 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1644,7 +1644,6 @@ "description": "[Required] The name of the action to be scheduled", "type": "string", "enum": [ - "logger", "test_SEA_CBRS_Measure_Baseline", "test_monitor_sigan", "test_multi_frequency_iq_action", diff --git a/src/requirements-dev.txt b/src/requirements-dev.txt index 4510d696..6626eb0b 100644 --- a/src/requirements-dev.txt +++ b/src/requirements-dev.txt @@ -313,7 +313,7 @@ scipy==1.10.1 # via # -r requirements.txt # scos-actions -scos-actions @ git+https://github.com/NTIA/scos-actions@SEA-178_test_actions_loading +scos-actions @ git+https://github.com/NTIA/scos-actions@revert-117-revert-110-SEA-178_test_actions_loading # via # -r requirements.txt # scos-tekrsa diff --git a/src/requirements.txt b/src/requirements.txt index 985445a7..c9b8f86d 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -149,7 +149,7 @@ ruamel-yaml-clib==0.2.8 # via ruamel-yaml scipy==1.10.1 # via scos-actions -scos-actions @ git+https://github.com/NTIA/scos-actions@SEA-178_test_actions_loading +scos-actions @ git+https://github.com/NTIA/scos-actions@revert-117-revert-110-SEA-178_test_actions_loading # via scos-tekrsa scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@SEA-178_test_actions_loading # via -r requirements.in diff --git a/src/schedule/tests/test_models.py b/src/schedule/tests/test_models.py index 4a8ed861..a16631c3 100644 --- a/src/schedule/tests/test_models.py +++ b/src/schedule/tests/test_models.py @@ -17,7 +17,7 @@ def test_take_until(test_input, future_t, expected): start, stop, interval = test_input entry = ScheduleEntry( - name="t", start=start, stop=stop, interval=interval, action="logger" + name="t", start=start, stop=stop, interval=interval, action="test_monitor_sigan" ) initial_times = list(entry.get_remaining_times()) r = [] @@ -32,32 +32,36 @@ def test_take_until(test_input, future_t, expected): def test_undefined_start_is_now(): - entry = ScheduleEntry(name="t", action="logger") + entry = ScheduleEntry(name="t", action="test_monitor_sigan") now = utils.timefn() assert entry.start in (now - 1, now, now + 1) def test_undefined_stop_is_never(): - entry = ScheduleEntry(name="t", action="logger", interval=1) + entry = ScheduleEntry(name="t", action="test_monitor_sigan", interval=1) assert entry.stop is None assert type(entry.get_remaining_times()) is itertools.count def test_relative_stop_becomes_absolute(): - e = ScheduleEntry(name="t", start=20, relative_stop=10, interval=1, action="logger") + e = ScheduleEntry( + name="t", start=20, relative_stop=10, interval=1, action="test_monitor_sigan" + ) assert e.start == 20 assert e.stop == 30 assert list(e.get_remaining_times()) == list(range(20, 30, 1)) def test_stop_before_start(): - e = ScheduleEntry(name="t", start=20, stop=10, interval=1, action="logger") + e = ScheduleEntry( + name="t", start=20, stop=10, interval=1, action="test_monitor_sigan" + ) assert list(e.get_remaining_times()) == list(range(0)) def test_no_interval_is_one_shot(): """Leaving `interval` blank should indicate "one-shot" entry.""" - e = ScheduleEntry(name="t", action="logger") + e = ScheduleEntry(name="t", action="test_monitor_sigan") remaining_times = list(e.get_remaining_times()) assert len(remaining_times) == 1 @@ -72,7 +76,7 @@ def test_no_interval_is_one_shot(): def test_no_interval_with_start_is_one_shot(): """Specifying start should not affect number of times.""" - e = ScheduleEntry(name="t", action="logger", start=1) + e = ScheduleEntry(name="t", action="test_monitor_sigan", start=1) remaining_times = list(e.get_remaining_times()) assert len(remaining_times) == 1 @@ -88,17 +92,19 @@ def test_no_interval_with_start_is_one_shot(): def test_no_interval_future_start(testclock): """One-shot entry should wait for start.""" # recall current t=0 so start=1 is 1 second in the future - e = ScheduleEntry(name="t", action="logger", start=1) + e = ScheduleEntry(name="t", action="test_monitor_sigan", start=1) assert not e.take_pending() def test_bad_interval_raises(): with pytest.raises(ValidationError): - ScheduleEntry(name="t", interval=-1, action="logger").clean_fields() + ScheduleEntry(name="t", interval=-1, action="test_monitor_sigan").clean_fields() with pytest.raises(ValidationError): - ScheduleEntry(name="t", interval=0, action="logger").clean_fields() + ScheduleEntry(name="t", interval=0, action="test_monitor_sigan").clean_fields() with pytest.raises(ValidationError): - ScheduleEntry(name="t", interval=0.1, action="logger").clean_fields() + ScheduleEntry( + name="t", interval=0.1, action="test_monitor_sigan" + ).clean_fields() def test_bad_action_raises(): @@ -108,22 +114,22 @@ def test_bad_action_raises(): def test_bad_name_raises(): with pytest.raises(ValidationError): # whitespace - ScheduleEntry(name="test 1", action="logger").clean_fields() + ScheduleEntry(name="test 1", action="test_monitor_sigan").clean_fields() with pytest.raises(ValidationError): # punctuation other than "_-" - ScheduleEntry(name="test1!", action="logger").clean_fields() + ScheduleEntry(name="test1!", action="test_monitor_sigan").clean_fields() # ok - ScheduleEntry(name="_test-Stuff123", action="logger").clean_fields() + ScheduleEntry(name="_test-Stuff123", action="test_monitor_sigan").clean_fields() def test_non_unique_name_raises(user): - ScheduleEntry(name="t", action="logger", owner=user).save() + ScheduleEntry(name="t", action="test_monitor_sigan", owner=user).save() with pytest.raises(ValidationError): - ScheduleEntry(name="t", action="logger", owner=user).full_clean() + ScheduleEntry(name="t", action="test_monitor_sigan", owner=user).full_clean() def test_defaults(): - entry = ScheduleEntry(name="t", action="logger") + entry = ScheduleEntry(name="t", action="test_monitor_sigan") assert entry.priority == DEFAULT_PRIORITY assert entry.start is not None assert entry.stop is None @@ -132,4 +138,4 @@ def test_defaults(): def test_str(): - str(ScheduleEntry(name="t", action="logger")) + str(ScheduleEntry(name="t", action="test_monitor_sigan")) diff --git a/src/schedule/tests/test_serializers.py b/src/schedule/tests/test_serializers.py index e7d0aa25..ce26fecc 100644 --- a/src/schedule/tests/test_serializers.py +++ b/src/schedule/tests/test_serializers.py @@ -17,39 +17,51 @@ [ # A name and action should be the minimum acceptable entry # i.e., (one-shot, ASAP) - {"name": "test", "action": "logger"}, + {"name": "test", "action": "test_monitor_sigan"}, # Stop 10 seconds after starting, start ASAP - {"name": "test", "action": "logger", "relative_stop": 10}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 10}, # Min integer interval ok - {"name": "test", "action": "logger", "interval": 10}, + {"name": "test", "action": "test_monitor_sigan", "interval": 10}, # Max priority ok - {"name": "test", "action": "logger", "priority": 19}, + {"name": "test", "action": "test_monitor_sigan", "priority": 19}, # Min user priority ok - {"name": "test", "action": "logger", "priority": 0}, + {"name": "test", "action": "test_monitor_sigan", "priority": 0}, # Stop 10 seconds after starting; start at absolute time { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25Z", "relative_stop": 10, }, # Start and stop at absolute time; equivalent to above { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25Z", "absolute_stop": "2018-03-16T17:12:35Z", }, # 'stop' and 'absolute_stop' are synonyms - {"name": "test", "action": "logger", "stop": "2018-03-16T17:12:35.0Z"}, + { + "name": "test", + "action": "test_monitor_sigan", + "stop": "2018-03-16T17:12:35.0Z", + }, # Subseconds are optional - {"name": "test", "action": "logger", "start": "2018-03-16T17:12:35Z"}, + { + "name": "test", + "action": "test_monitor_sigan", + "start": "2018-03-16T17:12:35Z", + }, # Sensor is timezone-aware - {"name": "test", "action": "logger", "start": "2018-03-22T13:53:25-06:00"}, + { + "name": "test", + "action": "test_monitor_sigan", + "start": "2018-03-22T13:53:25-06:00", + }, # All non-boolean, non-required fields accepts null to mean not defined { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": None, "absolute_stop": None, "relative_stop": None, @@ -60,7 +72,7 @@ "callback_url": None, }, # Explicit validate_only is valid - {"name": "test", "action": "logger", "validate_only": False}, + {"name": "test", "action": "test_monitor_sigan", "validate_only": False}, ], ) def test_valid_user_entries(entry_json, user): @@ -76,39 +88,51 @@ def test_valid_user_entries(entry_json, user): [ # A name and action should be the minimum acceptable entry # i.e., (one-shot, ASAP) - {"name": "test", "action": "logger"}, + {"name": "test", "action": "test_monitor_sigan"}, # Stop 10 seconds after starting, start ASAP - {"name": "test", "action": "logger", "relative_stop": 10}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 10}, # Min integer interval ok - {"name": "test", "action": "logger", "interval": 10}, + {"name": "test", "action": "test_monitor_sigan", "interval": 10}, # Max priority ok - {"name": "test", "action": "logger", "priority": 19}, + {"name": "test", "action": "test_monitor_sigan", "priority": 19}, # Min admin priority ok - {"name": "test", "action": "logger", "priority": -20}, + {"name": "test", "action": "test_monitor_sigan", "priority": -20}, # Stop 10 seconds after starting; start at absolute time { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25Z", "relative_stop": 10, }, # Start and stop at absolute time; equivalent to above { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25Z", "absolute_stop": "2018-03-16T17:12:35Z", }, # 'stop' and 'absolute_stop' are synonyms - {"name": "test", "action": "logger", "stop": "2018-03-16T17:12:35.0Z"}, + { + "name": "test", + "action": "test_monitor_sigan", + "stop": "2018-03-16T17:12:35.0Z", + }, # Subseconds are optional - {"name": "test", "action": "logger", "start": "2018-03-16T17:12:35Z"}, + { + "name": "test", + "action": "test_monitor_sigan", + "start": "2018-03-16T17:12:35Z", + }, # Sensor is timezone-aware - {"name": "test", "action": "logger", "start": "2018-03-22T13:53:25-06:00"}, + { + "name": "test", + "action": "test_monitor_sigan", + "start": "2018-03-22T13:53:25-06:00", + }, # All non-boolean, non-required fields accepts null to mean not defined { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": None, "absolute_stop": None, "relative_stop": None, @@ -119,9 +143,9 @@ def test_valid_user_entries(entry_json, user): "callback_url": None, }, # Explicit validate_only is valid - {"name": "test", "action": "logger", "validate_only": False}, + {"name": "test", "action": "test_monitor_sigan", "validate_only": False}, # Admin can create private entries - {"name": "test", "action": "logger"}, + {"name": "test", "action": "test_monitor_sigan"}, ], ) def test_valid_admin_entries(entry_json, user): @@ -136,44 +160,44 @@ def test_valid_admin_entries(entry_json, user): "entry_json", [ # name is a required field - {"action": "logger"}, + {"action": "test_monitor_sigan"}, # action is a required field {"name": "test"}, # non-integer priority - {"name": "test", "action": "logger", "priority": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "priority": 3.14}, # priority greater than max (19) - {"name": "test", "action": "logger", "priority": 20}, + {"name": "test", "action": "test_monitor_sigan", "priority": 20}, # non-integer interval - {"name": "test", "action": "logger", "interval": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "interval": 3.14}, # zero interval - {"name": "test", "action": "logger", "interval": 0}, + {"name": "test", "action": "test_monitor_sigan", "interval": 0}, # negative interval - {"name": "test", "action": "logger", "interval": -1}, + {"name": "test", "action": "test_monitor_sigan", "interval": -1}, # can't interpret both absolute and relative stop { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25.0Z", "absolute_stop": "2018-03-16T17:12:35.0Z", "relative_stop": 10, }, # 0 relative_stop - {"name": "test", "action": "logger", "relative_stop": 0}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 0}, # negative relative_stop - {"name": "test", "action": "logger", "relative_stop": -10}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": -10}, # non-integer relative_stop - {"name": "test", "action": "logger", "relative_stop": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 3.14}, # stop is before start { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:35Z", "stop": "2018-03-16T17:12:30Z", }, # stop is same as start { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:35Z", "stop": "2018-03-16T17:12:35Z", }, @@ -190,46 +214,46 @@ def test_invalid_user_entries(entry_json): "entry_json", [ # name is a required field - {"action": "logger"}, + {"action": "test_monitor_sigan"}, # action is a required field {"name": "test"}, # non-integer priority - {"name": "test", "action": "logger", "priority": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "priority": 3.14}, # priority less than min (for admin) - {"name": "test", "action": "logger", "priority": -21}, + {"name": "test", "action": "test_monitor_sigan", "priority": -21}, # priority greater than max (19) - {"name": "test", "action": "logger", "priority": 20}, + {"name": "test", "action": "test_monitor_sigan", "priority": 20}, # non-integer interval - {"name": "test", "action": "logger", "interval": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "interval": 3.14}, # zero interval - {"name": "test", "action": "logger", "interval": 0}, + {"name": "test", "action": "test_monitor_sigan", "interval": 0}, # negative interval - {"name": "test", "action": "logger", "interval": -1}, + {"name": "test", "action": "test_monitor_sigan", "interval": -1}, # can't interpret both absolute and relative stop { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:25.0Z", "absolute_stop": "2018-03-16T17:12:35.0Z", "relative_stop": 10, }, # 0 relative_stop - {"name": "test", "action": "logger", "relative_stop": 0}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 0}, # negative relative_stop - {"name": "test", "action": "logger", "relative_stop": -10}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": -10}, # non-integer relative_stop - {"name": "test", "action": "logger", "relative_stop": 3.14}, + {"name": "test", "action": "test_monitor_sigan", "relative_stop": 3.14}, # stop is before start { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:35Z", "stop": "2018-03-16T17:12:30Z", }, # stop is same as start { "name": "test", - "action": "logger", + "action": "test_monitor_sigan", "start": "2018-03-16T17:12:35Z", "stop": "2018-03-16T17:12:35Z", }, @@ -247,7 +271,9 @@ def test_invalid_admin_entries(entry_json): def test_serialized_fields(admin_client): """Certain fields on the schedule entry model should be serialized.""" - rjson = post_schedule(admin_client, {"name": "test", "action": "logger"}) + rjson = post_schedule( + admin_client, {"name": "test", "action": "test_monitor_sigan"} + ) # nullable fields assert "interval" in rjson @@ -274,6 +300,8 @@ def test_serialized_fields(admin_client): def test_non_serialized_fields(admin_client): """Certain fields on the schedule entry model should not be serialized.""" - rjson = post_schedule(admin_client, {"name": "test", "action": "logger"}) + rjson = post_schedule( + admin_client, {"name": "test", "action": "test_monitor_sigan"} + ) assert "relative_stop" not in rjson diff --git a/src/schedule/tests/utils.py b/src/schedule/tests/utils.py index ac8304be..3aa6b015 100644 --- a/src/schedule/tests/utils.py +++ b/src/schedule/tests/utils.py @@ -8,15 +8,15 @@ EMPTY_SCHEDULE_RESPONSE = [] -TEST_SCHEDULE_ENTRY = {"name": "test", "action": "logger"} +TEST_SCHEDULE_ENTRY = {"name": "test", "action": "test_monitor_sigan"} TEST_ALTERNATE_SCHEDULE_ENTRY = { "name": "test_alternate", - "action": "logger", + "action": "test_monitor_sigan", "priority": 5, } -TEST_PRIVATE_SCHEDULE_ENTRY = {"name": "test_private", "action": "logger"} +TEST_PRIVATE_SCHEDULE_ENTRY = {"name": "test_private", "action": "test_monitor_sigan"} def post_schedule(client, entry, expected_status=status.HTTP_201_CREATED): diff --git a/src/scheduler/tests/test_scheduler.py b/src/scheduler/tests/test_scheduler.py index 0dbede07..26577cf5 100644 --- a/src/scheduler/tests/test_scheduler.py +++ b/src/scheduler/tests/test_scheduler.py @@ -21,7 +21,7 @@ @pytest.mark.django_db def test_populate_queue(test_scheduler): """An entry in the schedule should be added to a read-only task queue.""" - create_entry("test", 1, 0, 5, 1, "logger") + create_entry("test", 1, 0, 5, 1, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) # now=0, so task with time 0 is run assert [e.time for e in s.task_queue] == [1, 2, 3, 4] @@ -32,8 +32,8 @@ def test_priority(test_scheduler): """A task with lower priority number should sort higher in task queue.""" lopri = 20 hipri = 10 - create_entry("lopri", lopri, 0, 5, 1, "logger") - create_entry("hipri", hipri, 0, 5, 1, "logger") + create_entry("lopri", lopri, 0, 5, 1, "test_monitor_sigan") + create_entry("hipri", hipri, 0, 5, 1, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) q = s.task_queue.to_list() @@ -45,7 +45,7 @@ def test_priority(test_scheduler): @pytest.mark.django_db def test_future_start(test_scheduler): """An entry with start time in future should remain in schedule.""" - create_entry("t", 1, 50, 100, 1, "logger") + create_entry("t", 1, 50, 100, 1, "test_monitor_sigan") test_scheduler.run(blocking=False) s = test_scheduler assert len(s.task_queue) == 0 @@ -75,11 +75,11 @@ def test_calls_actions(test_scheduler): @pytest.mark.django_db def test_add_entry(test_scheduler): """Creating a new entry instance adds it to the current schedule.""" - create_entry("t1", 10, 1, 100, 5, "logger") + create_entry("t1", 10, 1, 100, 5, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) advance_testclock(s.timefn, 49) - create_entry("t2", 20, 50, 300, 5, "logger") + create_entry("t2", 20, 50, 300, 5, "test_monitor_sigan") s.run(blocking=False) assert len(s.task_queue) == 20 assert s.task_queue[0].priority == 20 @@ -88,8 +88,8 @@ def test_add_entry(test_scheduler): @pytest.mark.django_db def test_remove_entry_by_delete(test_scheduler): """An entry is removed from schedule if it's deleted.""" - e1 = create_entry("t1", 10, 1, 300, 5, "logger") - e2 = create_entry("t2", 20, 50, 300, 5, "logger") + e1 = create_entry("t1", 10, 1, 300, 5, "test_monitor_sigan") + e2 = create_entry("t2", 20, 50, 300, 5, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) advance_testclock(s.timefn, 10) @@ -102,8 +102,8 @@ def test_remove_entry_by_delete(test_scheduler): @pytest.mark.django_db def test_remove_entry_by_cancel(test_scheduler): """scheduler.cancel removes an entry from schedule without deleting it.""" - e1 = create_entry("t1", 10, 1, 300, 5, "logger") - e2 = create_entry("t2", 20, 50, 300, 5, "logger") + e1 = create_entry("t1", 10, 1, 300, 5, "test_monitor_sigan") + e2 = create_entry("t2", 20, 50, 300, 5, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) advance_testclock(s.timefn, 10) @@ -116,7 +116,7 @@ def test_remove_entry_by_cancel(test_scheduler): @pytest.mark.django_db def test_start_stop(test_scheduler): """Calling stop on started scheduler thread should cause thread exit.""" - create_entry("t", 1, 1, 100, 5, "logger") + create_entry("t", 1, 1, 100, 5, "test_monitor_sigan") s = test_scheduler s.start() time.sleep(0.02) # hit minimum_duration @@ -130,7 +130,7 @@ def test_start_stop(test_scheduler): @pytest.mark.django_db def test_run_completes(test_scheduler): """The scheduler should return to idle state after schedule completes.""" - create_entry("t", 1, None, None, None, "logger") + create_entry("t", 1, None, None, None, "test_monitor_sigan") s = test_scheduler s.start() time.sleep(0.1) # hit minimum_duration @@ -159,7 +159,7 @@ def test_survives_failed_action(test_scheduler): @pytest.mark.django_db def test_compress_past_times(test_scheduler): """Multiple task times in the past should be compressed to one.""" - create_entry("t", 1, -10, 5, 1, "logger") + create_entry("t", 1, -10, 5, 1, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) # past times -10 through 0 are compressed and a single task is run, @@ -170,7 +170,7 @@ def test_compress_past_times(test_scheduler): @pytest.mark.django_db def test_compress_past_times_offset(test_scheduler): """Multiple task times in the past should be compressed to one.""" - create_entry("t", 1, -2, 14, 4, "logger") + create_entry("t", 1, -2, 14, 4, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) # past time -2 is run, then 2, 6, and 10 are queued @@ -182,7 +182,7 @@ def test_compress_past_times_offset(test_scheduler): @pytest.mark.django_db def test_next_task_time_value_when_start_changes(test_scheduler): """When an entry's start value changes, update `next_task_time`.""" - entry = create_entry("t", 1, 1, 10, 1, "logger") + entry = create_entry("t", 1, 1, 10, 1, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) assert entry.next_task_time == 1 @@ -218,7 +218,7 @@ def test_next_task_time_value_when_start_changes(test_scheduler): @pytest.mark.django_db def test_next_task_time_value_when_interval_changes(test_scheduler): """When an entry's interval value changes, update `next_task_time`.""" - entry = create_entry("t", 1, 1, 100, 1, "logger") + entry = create_entry("t", 1, 1, 100, 1, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) assert entry.next_task_time == 1 @@ -246,7 +246,7 @@ def test_next_task_time_value_when_interval_changes(test_scheduler): @pytest.mark.django_db def test_one_shot(test_scheduler): """If no start or interval given, entry should be run once and removed.""" - create_entry("t", 1, None, None, None, "logger") + create_entry("t", 1, None, None, None, "test_monitor_sigan") s = test_scheduler advance_testclock(s.timefn, 1) s.run(blocking=False) @@ -257,7 +257,7 @@ def test_one_shot(test_scheduler): @pytest.mark.django_db def test_task_queue(test_scheduler): """The scheduler should maintain a queue of upcoming tasks.""" - e = create_entry("t", 1, 1, 100, 5, "logger") + e = create_entry("t", 1, 1, 100, 5, "test_monitor_sigan") s = test_scheduler # upcoming tasks are queued @@ -282,7 +282,7 @@ def test_task_queue(test_scheduler): @pytest.mark.django_db def test_clearing_schedule_clears_task_queue(test_scheduler): """The scheduler should empty task_queue when schedule is deleted.""" - create_entry("t", 1, 1, 100, 5, "logger") + create_entry("t", 1, 1, 100, 5, "test_monitor_sigan") s = test_scheduler s.run(blocking=False) # queue first 10 tasks assert len(s.task_queue) == 10 @@ -416,7 +416,7 @@ def cb_request_handler(sess, resp): def test_notification_failed_status_unknown_host(test_scheduler): with requests_mock.Mocker() as m: callback_url = "https://results" - entry = create_entry("t", 1, 1, 100, 5, "logger", callback_url) + entry = create_entry("t", 1, 1, 100, 5, "test_monitor_sigan", callback_url) entry.save() token = entry.owner.auth_token m.post( @@ -437,7 +437,7 @@ def test_notification_failed_status_unknown_host(test_scheduler): @pytest.mark.django_db def test_notification_failed_status_request_ok_false(test_scheduler): - entry = create_entry("t", 1, 1, 100, 5, "logger") + entry = create_entry("t", 1, 1, 100, 5, "test_monitor_sigan") entry.save() entry.refresh_from_db() print("entry = " + entry.name)