-
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: podman run with log-opt option #12221
Conversation
This test case is used for covering rhbz#1763007. Signed-off-by: Alex Jia <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chuanchang The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM |
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.
Some suggestions. And please don't forget to update the commit message.
@test "podman run with log-opt option" { | ||
run_podman run -d --rm --log-opt max-size=1m $IMAGE sleep 5 | ||
cid=$output | ||
run_podman inspect --format "{{ .Config.CreateCommand }}" $cid |
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.
Wouldn't it be better to check {{.HostConfig.LogConfig.Size}}' instead?
CreateCommand` is just basically a parrot check; it doesn't actually confirm that the option was parsed properly.
@@ -736,4 +736,14 @@ EOF | |||
is "$output" "$random_1" "output matches STDIN" | |||
} | |||
|
|||
# rhbz#1763007 : the --log-opt for podman run does not work as expected | |||
@test "podman run with log-opt option" { | |||
run_podman run -d --rm --log-opt max-size=1m $IMAGE sleep 5 |
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.
It can be useful to test with variable settings. Suggestion:
# Pseudorandom size of the form N.NNN. The '| 1' handles '0.NNN' or 'N.NN0',
# which podman displays as 'NNN kB' or 'N.NN MB' respectively.
size=$(printf "%d.%03d" $(($RANDOM % 10 | 1)) $(($RANDOM % 100 | 1)))
run_podman run -d --rm --log-opt max-size=${size}m $IMAGE sleep 5
cid=$output
run_podman inspect --format "{{ .HostConfig.LogConfig.Size }}" $cid
is "$output" "${size}MB"
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.
This test doesn't verify anything. You are checking the stored create command with is just os.Args
. There is absolutely no guarantee that this value is used. I think a proper test should set the limit to something very low and write more bytes than the max size and then check that the file does not exceed the limit.
@chuanchang: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@chuanchang please rebase |
A friendly reminder that this PR had no activity for 30 days. |
This test case is used for covering rhbz#1763007. Replaces: containers#12221 Signed-off-by: Alex Jia <[email protected]> Signed-off-by: Daniel J Walsh <[email protected]>
This test case is used for covering rhbz#1763007.
Signed-off-by: Alex Jia [email protected]
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer: