Skip to content

Commit

Permalink
test: mark linux job user override tests as flaky (#482)
Browse files Browse the repository at this point in the history
Signed-off-by: Li <[email protected]>
  • Loading branch information
YutongLi291 authored Nov 16, 2024
1 parent 0a4e65b commit fee2dd8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/e2e/test_override_job_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DeadlineClient,
EC2InstanceWorker,
)

from flaky import flaky

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -319,6 +319,9 @@ def test_no_user_override(

assert job.task_run_status == TaskStatus.SUCCEEDED

@flaky(
max_runs=3, min_passes=1
) # Flaky due to varying instance types causing race conditions with user reassignment
def test_config_file_user_override(
self,
deadline_resources,
Expand Down Expand Up @@ -346,7 +349,7 @@ def check_worker_service_stopped() -> None:
check_worker_service_stopped()

cmd_result = class_worker.send_command(
f'sed -i \'s/# posix_job_user = "user:group"/posix_job_user = "{posix_config_override_job_user.user}:{posix_config_override_job_user.group}"/g\' /etc/amazon/deadline/worker.toml'
command=f'sed -i \'s/# posix_job_user = "user:group"/posix_job_user = "{posix_config_override_job_user.user}:{posix_config_override_job_user.group}"/g\' /etc/amazon/deadline/worker.toml'
)
assert (
cmd_result.exit_code == 0
Expand Down Expand Up @@ -376,12 +379,15 @@ def check_worker_service_stopped() -> None:
assert job.task_run_status == TaskStatus.SUCCEEDED
finally:
cmd_result = class_worker.send_command(
f"sed -i '/posix_job_user = \"{posix_config_override_job_user.user}:{posix_config_override_job_user.group}\"/d' /etc/amazon/deadline/worker.toml"
command=f'sed -i \'s/posix_job_user = "{posix_config_override_job_user.user}:{posix_config_override_job_user.group}"/# posix_job_user = "user:group"/g\' /etc/amazon/deadline/worker.toml'
)
assert (
cmd_result.exit_code == 0
), f"Resetting the job user override via CLI failed: {cmd_result}"

@flaky(
max_runs=3, min_passes=1
) # Flaky due to varying instance types causing race conditions with user reassignment
def test_env_var_user_override(
self,
deadline_resources,
Expand Down

0 comments on commit fee2dd8

Please sign in to comment.