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

chore: add jobRunAsUser integration test #54

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Conversation

jericht
Copy link
Contributor

@jericht jericht commented Oct 12, 2023

Depends on

aws-deadline/deadline-cloud-test-fixtures#25

What was the problem/requirement? (What/Why)

We need an integration test verifying the worker respects the jobRunAsUser option on queues

What was the solution? (How)

Add integ test for above

What is the impact of this change?

We have an integ test for above

How was this change tested?

Ran the integ test and verified it succeeded (logs below)

Was this change documented?

No

Is this a breaking change?

No

Test logs

Test runner logs

------------------------------------------------------------------------------------------------------------------------------ live log call -------------------------------------------------------------------------------------------------------------------------------
[2023-10-12 18:07:07,035] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] About to call API (Create job in farm farm-09b495690b6049f1b4efde628b935087 and queue queue-f3ca44f264474c5cb01453a46122da8f)
[2023-10-12 18:07:07,512] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] API call succeeded (Create job in farm farm-09b495690b6049f1b4efde628b935087 and queue queue-f3ca44f264474c5cb01453a46122da8f)
[2023-10-12 18:07:07,512] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Created job: job-ff10e9bb69004d6d928bc9d27278c2b8
[2023-10-12 18:07:07,512] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] About to call API (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:07,618] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] API call succeeded (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:07,618] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Waiting for job job-ff10e9bb69004d6d928bc9d27278c2b8 to complete
[2023-10-12 18:07:07,619] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] About to call API (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:07,735] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] API call succeeded (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:07,736] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Job job-ff10e9bb69004d6d928bc9d27278c2b8 not complete
[2023-10-12 18:07:07,736] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Retrying in 10s...
[2023-10-12 18:07:17,746] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] About to call API (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:17,871] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] API call succeeded (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:17,871] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Job job-ff10e9bb69004d6d928bc9d27278c2b8 not complete
[2023-10-12 18:07:17,871] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] Retrying in 10s...
[2023-10-12 18:07:27,881] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] About to call API (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
[2023-10-12 18:07:28,005] [test/integ/test_job_submissions.py::TestJobSubmission::test_jobs_run_as_user] API call succeeded (Fetching job details for job job-ff10e9bb69004d6d928bc9d27278c2b8)
PASSED                                                                                                                                        [100%]

Session logs

Session running with no AWS Credentials.
--
Starting Task onRun Action at 2023-10-12T18:07:20Z
Writing embedded files for Task to disk.
Mapping: Task.File.whoami -> /tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/embedded_fileszrmcosij/tmp09e6vk3s
Wrote: whoami -> /tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/embedded_fileszrmcosij/tmp09e6vk3s
Wrote the following script to /tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/tmppupfiij9.sh:#!/bin/sh_term() {  echo 'Caught SIGTERM'  test "${CHILD_PID:-}" != "" && echo "Sending SIGTERM to ${CHILD_PID}" && kill -s TERM "${CHILD_PID}"  wait "${CHILD_PID}"  exit $?}trap _term TERMcd '/tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5'/tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/embedded_fileszrmcosij/tmp09e6vk3s &CHILD_PID=$!wait "$CHILD_PID"exit $?
Running command sudo -u job-run-as-user -i setsid -w /tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/tmppupfiij9.sh
Command started as pid: 2454
I am: job-run-as-user
Running command sudo -u job-run-as-user -i setsid -w rm -rf '/tmp/openjd/session-603e61dc3f464a11ba218467495b65bd_ykgntp5/*'
Command started as pid: 2478

Worker agent logs

Synchronizing with service (sending UpdateWorkerSchedule)
--
{'log_type': 'boto_request', 'operation': 'deadline.BatchGetJobEntity', 'params': {}, 'request_url': 'https://scheduling.beta.bealine-dev.us-west-2.amazonaws.com/2023-10-12/farms/farm-09b495690b6049f1b4efde628b935087/fleets/fleet-0a7448a303a14adbbefb60e5dc228340/workers/worker-25bcfb20da3f4b4b83675d309ace98fc/batchGetJobEntity'}
{'log_type': 'boto_response', 'operation': 'deadline.BatchGetJobEntity', 'status_code': 200, 'params': {}}
Fetched jobDetails(job-ff10e9bb69004d6d928bc9d27278c2b8)
Enqueued new action: {'sessionActionId': 'sessionaction-603e61dc3f464a11ba218467495b65bd-0', 'actionType': 'TASK_RUN', 'taskId': 'task-42107de274dd49edb537cc5bd1b21570-0', 'stepId': 'step-42107de274dd49edb537cc5bd1b21570'}
Job has no Queue Role. Not obtaining AWS Credentials for the Session.
Done synchronizing with service
[session-603e61dc3f464a11ba218467495b65bd] logs streamed to CloudWatch target: /aws/deadline/farm-09b495690b6049f1b4efde628b935087/queue-f3ca44f264474c5cb01453a46122da8f/session-603e61dc3f464a11ba218467495b65bd
[session-603e61dc3f464a11ba218467495b65bd] local logs target: /var/log/amazon/deadline/queue-f3ca44f264474c5cb01453a46122da8f/session-603e61dc3f464a11ba218467495b65bd.log
Warming Job Entity Cache
{'log_type': 'boto_request', 'operation': 'deadline.BatchGetJobEntity', 'params': {}, 'request_url': 'https://scheduling.beta.bealine-dev.us-west-2.amazonaws.com/2023-10-12/farms/farm-09b495690b6049f1b4efde628b935087/fleets/fleet-0a7448a303a14adbbefb60e5dc228340/workers/worker-25bcfb20da3f4b4b83675d309ace98fc/batchGetJobEntity'}
{'log_type': 'boto_response', 'operation': 'deadline.BatchGetJobEntity', 'status_code': 200, 'params': {}}
Fetched stepDetails(step-42107de274dd49edb537cc5bd1b21570)
Fully warmed Job Entity Cache
[session-603e61dc3f464a11ba218467495b65bd]: Session started
[session-603e61dc3f464a11ba218467495b65bd] [sessionaction-603e61dc3f464a11ba218467495b65bd-0] (step[step-42107de274dd49edb537cc5bd1b21570].run()): Starting action
[session-603e61dc3f464a11ba218467495b65bd] [sessionaction-603e61dc3f464a11ba218467495b65bd-0] (step[step-42107de274dd49edb537cc5bd1b21570].run()): Action completed as SUCCEEDED
Synchronizing with service (sending UpdateWorkerSchedule)
Updating actions: {'sessionaction-603e61dc3f464a11ba218467495b65bd-0': {'startedAt': datetime.datetime(2023, 10, 12, 18, 7, 20, 699589, tzinfo=datetime.timezone.utc), 'completedStatus': 'SUCCEEDED', 'processExitCode': 0, 'endedAt': datetime.datetime(2023, 10, 12, 18, 7, 20, 905813, tzinfo=datetime.timezone.utc)}}
[session-603e61dc3f464a11ba218467495b65bd]: Session complete
Cleaning up remaining session user processes for 'job-run-as-user'
No processes stopped because none were found running as 'job-run-as-user'
Done synchronizing with service

@jericht jericht changed the title chore: add jobsRunAsUser integration test chore: add jobRunAsUser integration test Oct 12, 2023
@jericht jericht marked this pull request as ready for review October 12, 2023 21:06
@jericht jericht requested a review from a team as a code owner October 12, 2023 21:06
@jericht jericht merged commit 6fea9e5 into mainline Oct 12, 2023
8 checks passed
@jericht jericht deleted the jericht/bgje_test branch October 12, 2023 21:20
gmchale79 pushed a commit that referenced this pull request Oct 31, 2023
Signed-off-by: Jericho Tolentino <[email protected]>
Signed-off-by: Graeme McHale <[email protected]>
gmchale79 pushed a commit that referenced this pull request Nov 2, 2023
Signed-off-by: Jericho Tolentino <[email protected]>
Signed-off-by: Graeme McHale <[email protected]>
gahyusuh pushed a commit that referenced this pull request Nov 6, 2023
Signed-off-by: Jericho Tolentino <[email protected]>
Signed-off-by: Graeme McHale <[email protected]>
Signed-off-by: Gahyun Suh <[email protected]>
gmchale79 pushed a commit that referenced this pull request Feb 12, 2024
Signed-off-by: Jericho Tolentino <[email protected]>
Signed-off-by: Graeme McHale <[email protected]>
gmchale79 pushed a commit that referenced this pull request Mar 11, 2024
Signed-off-by: Jericho Tolentino <[email protected]>
Signed-off-by: Graeme McHale <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants