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

More log-flake work #16437

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ var _ = Describe("Podman logs", func() {
Expect(logc).To(Exit(0))
cid := logc.OutputToString()

results := podmanTest.Podman([]string{"logs", cid})
results := podmanTest.Podman([]string{"wait", cid})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is special about this test? The other test below use the same logic without wait as well.

You could also just remove the -d from podman run instead of the extra wait call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's special is that this is another podman logs flake. I haven't seen flakes in those other tests, so I didn't look at them.

Removing -d was my first choice, but I realized I don't know enough about logging to know if it behaves differently under -d. I chose to assume the test author used it that way for a reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging doesn't behave differently.
But if you use -d we will detach directly and not wait for exit, without -d we will wait for exit, thus podman wait would not be needed in that case.

results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))

results = podmanTest.Podman([]string{"logs", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
Expect(results.OutputToStringArray()).To(HaveLen(3))
Expand Down
1 change: 1 addition & 0 deletions test/system/200-pod.bats
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ EOF
echo "$teststring" | nc 127.0.0.1 $port_out

# Confirm that the container log output is the string we sent it.
run_podman wait $cid
run_podman logs $cid
is "$output" "$teststring" "test string received on container"

Expand Down
7 changes: 7 additions & 0 deletions test/system/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ function wait_for_output {
if [ $output != "true" ]; then
run_podman inspect --format '{{.State.ExitCode}}' $cid
exitcode=$output

# One last chance: maybe the container exited just after logs cmd
run_podman logs $cid
if expr "$logs" : ".*$expect" >/dev/null; then
return
fi

die "Container exited (status: $exitcode) before we saw '$expect': $logs"
fi

Expand Down