Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing test for db maintenance mode terminate error #710

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/test_local_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,33 @@ def test_running_job_terminated_finalized(docker_cleanup, job_definition, tmp_wo
assert not workspace_log_file_exists(job_definition)


@pytest.mark.needs_docker
def test_executed_job_db_maintenance_mode(docker_cleanup, job_definition, tmp_work_dir):
job_definition.args = ["sleep", "50"]

api = local.LocalDockerAPI()

status = api.prepare(job_definition)
assert status.state == ExecutorState.PREPARED
assert api.get_status(job_definition).state == ExecutorState.PREPARED

status = api.execute(job_definition)
assert status.state == ExecutorState.EXECUTING
assert api.get_status(job_definition).state == ExecutorState.EXECUTING

# the job completes successfully, although job.state remains RUNNING
# wait >50 seconds here to simulate this
time.sleep(75)

assert api.get_status(job_definition).state == ExecutorState.EXECUTED

# if we're not in db maintenance mode, we do not run terminate(), but
# if we are then we currently do
status = api.terminate(job_definition)
assert status.state == ExecutorState.EXECUTED
assert api.get_status(job_definition).state == ExecutorState.EXECUTED


@pytest.mark.needs_docker
def test_cleanup_success(docker_cleanup, job_definition, tmp_work_dir, volume_api):
populate_workspace(job_definition.workspace, "output/input.csv")
Expand Down
Loading