-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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/system: Add a test case for automount with multi images #23301
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you merge the test with the other one above and reuse that image there. Building is slow and we are actively working on increasing the performance of system test so every second matters.
test/system/700-play.bats
Outdated
@@ -1035,3 +1035,72 @@ spec: | |||
run_podman rm -f -t 0 -a | |||
run_podman rmi automount_test | |||
} | |||
|
|||
@test "podman ply with multi automount volume" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo play
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
test/system/700-play.bats
Outdated
RUN mkdir /test1 /test_same | ||
RUN touch /test1/a /test1/b /test1/c | ||
RUN echo "I am from test1 image" > /test_same/hello_world |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please chain them via && \
instead of desperate RUN instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Will update this.
test/system/700-play.bats
Outdated
RUN mkdir /test2 /test_same | ||
RUN touch /test2/asdf /test2/ejgre /test2/lteghe | ||
RUN echo "I am from test2 image" > /test_same/hello_world |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
test/system/700-play.bats
Outdated
metadata: | ||
labels: | ||
app: test | ||
name: test_pod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
700-play
is next on my list for refactoring. @ypu if you wait maybe a week or so, until my (not-yet-filed) PR merges, you will have a much better base to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Luap99 and @edsantiago . Will wait for Ed’s PR for refactoring the script.
Thanks @Luap99 and @edsantiago for your comments. And will work with the test case after Ed’s refactor for the script get done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase, and take a look at the new 700-play.bats
. In particular, the way there are no longer any hardcoded names. I've added a few suggestions inline. Thank you!
test/system/700-play.bats
Outdated
run_podman build -t test1 -f $PODMAN_TMPDIR/Containerfile1 | ||
run_podman build -t test2 -f $PODMAN_TMPDIR/Containerfile2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
img1="i1-$(safename)"
img2="i2-$(safename)"
build -t $img1 ...
test/system/700-play.bats
Outdated
run_podman kube play $fname | ||
|
||
run_podman run --rm test1 ls /test1 | ||
run_out_test1="$output" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check this for validity. Comparing the ls
output is not useful if both show mistaken results.
test/system/700-play.bats
Outdated
run_podman exec test_pod-testctr cat /test_same/hello_world | ||
assert "I am from test2 image" "test_same should from image2" | ||
|
||
run_podman 1 exec test_pod-testctr touch /test1/readonly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message check please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
/release-note-none |
Hi @edsantiago and @Luap99 pullreq updated. Can you help to review it again? Thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass review. I'm still having trouble understanding everything that is happening here; there may be other issues I've missed. Please address these, rebase, and I'll take another look.
test/system/700-play.bats
Outdated
run_podman run --rm $imgname1 ls -x / | ||
run_podman run --rm $imgname2 ls -x / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these debugging leftovers? If so please remove.
test/system/700-play.bats
Outdated
run_podman exec "$podname_file-$ctrname_file" ls -x /test1 | ||
assert "a b c" "ls /test1 on image" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is now wrong. "on image" means "this is a test being run on the image itself, via podman run". You changed it to "podman exec", which is on the container. It is necessary to do both.
test/system/700-play.bats
Outdated
assert "$output" =~ "Read-only file system" "image mounted as readonly" | ||
|
||
run_podman exec "$podname_file-$ctrname_file_not_mounted" ls / | ||
assert "test" !~ "$output" "No volume should be mounted in $podname_file-$ctrname_file_not_mounted" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong order, it should be assert "$output" !~ "test"
.
Suggestion: just "No volume should be mounted in the no-mount container". There's no reason to include the entire actual container name, that just makes for a hard-to-read error message.
test/system/700-play.bats
Outdated
imgname1="automount-test-$(safename)1" | ||
imgname2="automount-test-$(safename)2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: automount-test1-$(safename)
and -test2-
. The way they are now, 1 and 2 appear at the end of a random string, making it impossible for a human to see the difference between them.
test/system/700-play.bats
Outdated
podname_file="p-$(safename)-file" | ||
ctrname_file="c-$(safename)-file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I see a variable of the form xxx_file
, my brain thinks "this references a file path". Even after staring at this code for half an hour, I still can't get used to the fact that this means "pod and container that have something to do with a file". Could you think of variable names that better reflect the nature of the test being run?
test/system/700-play.bats
Outdated
|
||
run_podman run --rm $imgname1 cat /test_same/hello_world | ||
assert "$output" = "I am from test1 image" "cat /test_same/hello_world on image" | ||
run_out_test2="$output" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eek, no, bad variable name. This needs to be test1
These test steps check the automount feature with multi images for following item: 1. multi images can be auotmounted with yaml file. 2. if there are same path exist in the images, the last one should trumps. 3. the volume is mounted readonly in the container. 4. the volumes are only mounted in the specific container, but not the whole pods. Signed-off-by: Yiqiao Pu <[email protected]>
Hi @edsantiago sorry to not consider the variable names and assert messages when combine two tests. Now I just remove the debug line, update the variables and assert messages. Can you help to check it again? Thanks a lot! |
LGTM, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, Luap99, ypu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This test check the automount feature with multi images for following item:
Does this PR introduce a user-facing change?