diff options
author | Ed Santiago <santiago@redhat.com> | 2021-02-02 14:17:15 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2021-02-02 17:48:00 -0700 |
commit | 1c50e09b065ea113e0a138abbed232b54c8b96a5 (patch) | |
tree | 6f9b9515d7dacf397b28290ceba6a505d9c424d7 /test/system/030-run.bats | |
parent | d1e0afdd47c1868ce0d22e48ae9b0b9d89ba6274 (diff) | |
download | podman-1c50e09b065ea113e0a138abbed232b54c8b96a5.tar.gz podman-1c50e09b065ea113e0a138abbed232b54c8b96a5.tar.bz2 podman-1c50e09b065ea113e0a138abbed232b54c8b96a5.zip |
System test for #9096 (truncated stdout)
This actually tests conmon, not podman; but that's the whole
point of system tests in the first place: if a problem exists,
we want to fail loudly, no matter whose fault it is.
(I can't get this to fail on my f33 laptop; OP on #9096 claims
it only fails on Ubuntu. We'll see what happens in CI).
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r-- | test/system/030-run.bats | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index dcf1da370..6c3812dce 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -610,4 +610,43 @@ json-file | f is "$output" "$randomcontent" "cat random content" } +# https://github.com/containers/podman/issues/9096 +# podman exec may truncate stdout/stderr; actually a bug in conmon: +# https://github.com/containers/conmon/issues/236 +@test "podman run - does not truncate or hang with big output" { + # Size, in bytes, to dd and to expect in return + char_count=700000 + + # Container name; primarily needed when running podman-remote + cname=mybigdatacontainer + + # This is one of those cases where BATS is not the best test framework. + # We can't do any output redirection, because 'run' overrides it so + # as to preserve $output. We can't _not_ do redirection, because BATS + # doesn't like NULs in $output (and neither would humans who might + # have to read them in an error log). + # Workaround: write to a log file, and don't attach stdout. + run_podman run --name $cname --attach stderr --log-driver k8s-file \ + $IMAGE dd if=/dev/zero count=$char_count bs=1 + is "${lines[0]}" "$char_count+0 records in" "dd: number of records in" + is "${lines[1]}" "$char_count+0 records out" "dd: number of records out" + + # We don't have many tests for '-l'. This is as good a place as any + if ! is_remote; then + cname=-l + fi + + # Now find that log file, and count the NULs in it. + # The log file is of the form '<timestamp> <P|F> <data>', where P|F + # is Partial/Full; I think that's called "kubernetes log format"? + run_podman inspect $cname --format '{{.HostConfig.LogConfig.Path}}' + logfile="$output" + + count_zero=$(tr -cd '\0' <$logfile | wc -c) + is "$count_zero" "$char_count" "count of NULL characters in log" + + # Clean up + run_podman rm $cname +} + # vim: filetype=sh |