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

test: make credentials tests more robust to wait for job to start #499

Merged
merged 1 commit into from
Dec 3, 2024
Merged
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
35 changes: 32 additions & 3 deletions test/e2e/test_job_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,19 @@ def test_queue_credentials_file_is_secure_from_other_users(
def is_job_started(current_job: Job) -> bool:
current_job.refresh_job_info(client=deadline_client)
LOG.info(f"Waiting for job {current_job.id} to be created")
return current_job.lifecycle_status != "CREATE_IN_PROGRESS"

assert current_job.task_run_status not in [
TaskStatus.INTERRUPTING,
TaskStatus.SUSPENDED,
TaskStatus.CANCELED,
TaskStatus.FAILED,
TaskStatus.SUCCEEDED,
TaskStatus.NOT_COMPATIBLE,
], f"Job is not in a valid task run status for this test: {current_job.task_run_status}"
return (
current_job.lifecycle_status != "CREATE_IN_PROGRESS"
and current_job.task_run_status == TaskStatus.RUNNING
)

assert is_job_started(job)

Expand Down Expand Up @@ -148,12 +160,17 @@ def test_queue_credentials_file_is_secure_from_other_queues(
) -> None:
# Test to verify that the queue credentials can never be accessed by a different queue's job user

job = submit_sleep_job(
job = submit_custom_job(
"Test Sleep",
deadline_client,
deadline_resources.farm,
deadline_resources.queue_a,
"""
#!/usr/bin/env bash
sleep 60
""",
)

try:

@backoff.on_predicate(
Expand All @@ -164,7 +181,19 @@ def test_queue_credentials_file_is_secure_from_other_queues(
def is_job_started(current_job: Job) -> bool:
current_job.refresh_job_info(client=deadline_client)
LOG.info(f"Waiting for job {current_job.id} to be created")
return current_job.lifecycle_status != "CREATE_IN_PROGRESS"

assert current_job.task_run_status not in [
TaskStatus.INTERRUPTING,
TaskStatus.SUSPENDED,
TaskStatus.CANCELED,
TaskStatus.FAILED,
TaskStatus.SUCCEEDED,
TaskStatus.NOT_COMPATIBLE,
], f"Job is not in a valid task run status for this test: {current_job.task_run_status}"
return (
current_job.lifecycle_status != "CREATE_IN_PROGRESS"
and current_job.task_run_status == TaskStatus.RUNNING
)

assert is_job_started(job)

Expand Down
Loading