freezer.tests.unit.scheduler.test_scheduler_job module

class freezer.tests.unit.scheduler.test_scheduler_job.TestJobLockRetryBackoff(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_add_job_failure_is_logged_not_raised()
test_attempts_freeze_once_capped()
test_cancel_swallows_missing_retry_job()
test_delay_is_capped_at_max()
test_first_retry_uses_base_delay()
test_retries_when_own_schedule_fires_later()
test_second_retry_doubles_the_delay()
test_skips_retry_when_own_schedule_fires_sooner()
test_success_resets_backoff_and_cancels_pending_retry()
class freezer.tests.unit.scheduler.test_scheduler_job.TestJobUpdateActionsRegression(methodName='runTest')

Bases: TestCase

Replacing a job’s actions through the API must take effect.

FreezerScheduler.poll reuses the in-memory Job across polls and hands the freshly fetched doc to job.process_event(job_doc). These tests drive that call, then fire execute() the way APScheduler does when the trigger comes due, and record which actions actually run.

NEW_ACTIONS = [{'freezer_action': {'action': 'backup', 'backup_name': 'NEW'}}]
OLD_ACTIONS = [{'freezer_action': {'action': 'backup', 'backup_name': 'OLD'}}]
setUp()

Hook method for setting up the test fixture before exercising it.

test_changed_schedule_re_arms_the_job()

An armed, idle job whose trigger changed must be re-armed, or it keeps firing on the old interval.

test_process_event_refreshes_job_doc_actions()

Lower-level assertion: once a poll delivers an updated doc, the in-memory job_doc must reflect the new actions.

test_refresh_does_not_write_back_into_the_polled_doc()

Runtime mutations must not leak into the doc list the scheduler polled, which is discarded and re-fetched every cycle.

test_refresh_preserves_scheduler_runtime_bookkeeping()

The API’s copy of the runtime fields is older than ours, so a refresh must not roll back status, timings or the running pid.

test_running_job_is_not_re_armed_mid_execution()

Re-arming a running job would reset its state machine while the agent is still working; the new trigger can wait for the next poll.

test_scheduled_job_runs_new_actions_after_patch_no_event()

A normally-scheduled job carries no pending event, so the doc delivered by the next poll must still replace its actions.

test_scheduled_job_runs_new_actions_after_patch_with_start_event()

Same, but the refreshed doc still carries a ‘start’ event; ScheduledState.start currently ignores the incoming doc entirely.

test_unchanged_schedule_does_not_re_arm()

Replacing only the actions must not disturb the trigger.

class freezer.tests.unit.scheduler.test_scheduler_job.TestSchedulerJob(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test()
test_save_action_to_disk()
test_save_action_with_bool_value_to_disk()
test_save_action_with_none_value_to_disk()
class freezer.tests.unit.scheduler.test_scheduler_job.TestSchedulerJob1(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_execute_job_action_env_propagation(mock_popen)
test_execute_job_action_pre_create_fails_continues()
test_execute_job_action_pre_creates_cindernative_backup()
test_get_schedule_args()
test_get_schedule_args_start_date_after_end_date()
test_get_schedule_args_timezone_aware()
test_job_can_be_removed()
test_job_contains_exec()
test_job_create()
test_job_end_session()
test_job_execute(mock_process)
test_job_execute_with_trust(mock_process)
test_job_finish()
test_job_process_agent_output()
test_job_process_agent_output_invalid_json()
test_job_process_event()
test_job_remove()
test_job_result()
test_job_schedule()
test_job_schedule_cron_fields()
test_job_schedule_end_date()
test_job_schedule_timezone_aware()
test_job_session_id()
test_job_session_tag()
test_job_start_session()
test_job_terminate_kill()
test_job_unschedule()
test_job_update_job_schedule_doc()
test_runningstate_abort()
test_runningstate_remove()
test_runningstate_start()
test_runningstate_stop()
test_save_action_to_file()
test_scheduledstate_abort()
test_scheduledstate_remove()
test_scheduledstate_start()
test_scheduledstate_stop()
test_stopstate_abort()
test_stopstate_remove()
test_stopstate_start()
test_stopstate_stop()
class freezer.tests.unit.scheduler.test_scheduler_job.TestSchedulerJobCapabilities(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_job_supported_action()

check_capabilities of a job that contains only allowed actions. The job should be accepted.

test_job_supported_engine()

check_capabilities of a job that contains only allowed engines. The job should be accepted.

test_job_supported_mode()

check_capabilities of a job that contains only allowed modes. The job should be accepted.

test_job_supported_storage()

check_capabilities of a job that contains only allowed storages. The job should be accepted.

test_job_unsupported_action()

check_capabilities of a job that contains allowed and disallowed actions. The job should be rejected.

test_job_unsupported_engine()

check_capabilities of a job that contains disallowed engines. The job should be rejected.

test_job_unsupported_mode()

check_capabilities of a job that contains allowed and disallowed modes. The job should be rejected.

test_job_unsupported_storage()

check_capabilities of a job that contains allowed and disallowed storages. The job should be rejected.