From fee2dd841ff0d7bd239daa6b712674e5d4f2efef Mon Sep 17 00:00:00 2001 From: Yutong Li <52769999+YutongLi291@users.noreply.github.com> Date: Sat, 16 Nov 2024 07:06:46 -0800 Subject: [PATCH] test: mark linux job user override tests as flaky (#482) Signed-off-by: Li <52769999+YutongLi291@users.noreply.github.com> --- test/e2e/test_override_job_user.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/e2e/test_override_job_user.py b/test/e2e/test_override_job_user.py index 4ca8600e..d352e740 100644 --- a/test/e2e/test_override_job_user.py +++ b/test/e2e/test_override_job_user.py @@ -22,7 +22,7 @@ DeadlineClient, EC2InstanceWorker, ) - +from flaky import flaky LOG = logging.getLogger(__name__) @@ -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, @@ -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 @@ -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,