Skip to content

Commit ef30452

Browse files
committed
Avoid comparing embedded script in unit tests
The test_create_job_nowait test was sensitive to the content of the embedded rsync script. For the purposes of the test we don't care about the script content, so delete it from the comparison.
1 parent be7cb54 commit ef30452

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_br.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ def test_create_job_nowait(
8181
{
8282
"name": "job-v100-123-container",
8383
"image": "image-registry.openshift-image-registry.svc:5000/redhat-ods-applications/csw-run-f25:latest",
84-
"command": [
85-
"/bin/bash",
86-
"-c",
87-
f"\nset -e\nexport RSYNC_RSH='oc rsh -c container1'\n\nmkdir -p job-v100-123\n\nrsync -q --archive --no-owner --no-group --omit-dir-times --numeric-ids testhost:{tempdir}/jobs/job-v100-123/getlist job-v100-123/getlist\nrsync -q -r --archive --no-owner --no-group --omit-dir-times --numeric-ids --files-from=job-v100-123/getlist testhost:{tempdir}/ job-v100-123/\nfind job-v100-123 -mindepth 1 -maxdepth 1 > job-v100-123/gotlist\n\n(\n cd job-v100-123 && |& tee job-v100-123.log\n)\n\nrsync -q --archive --no-owner --no-group --omit-dir-times --no-relative --numeric-ids --exclude-from=job-v100-123/gotlist job-v100-123 testhost:{tempdir}/jobs\n",
88-
],
8984
"resources": {
9085
"requests": {"nvidia.com/gpu": "1"},
9186
"limits": {"nvidia.com/gpu": "1"},
@@ -99,4 +94,9 @@ def test_create_job_nowait(
9994

10095
CreateJobCommand.run(args)
10196

97+
# Prevent changes in the embedded script from breaking
98+
# this test.
99+
del mock_create.call_args.args[0]["spec"]["template"]["spec"]["containers"][0][
100+
"command"
101+
]
102102
assert mock_create.call_args.args[0] == expected

0 commit comments

Comments
 (0)