summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/compose/test-compose38
-rw-r--r--test/e2e/play_kube_test.go1
-rw-r--r--test/system/001-basic.bats13
-rw-r--r--test/system/037-runlabel.bats32
-rw-r--r--test/system/050-stop.bats1
-rw-r--r--test/system/070-build.bats12
6 files changed, 82 insertions, 15 deletions
diff --git a/test/compose/test-compose b/test/compose/test-compose
index 7693041ac..46ca80321 100755
--- a/test/compose/test-compose
+++ b/test/compose/test-compose
@@ -136,8 +136,11 @@ function _show_ok() {
local expect=$3
local actual=$4
printf "${red}not ok $count $testname${reset}\n"
- printf "${red}# expected: %s${reset}\n" "$expect"
- printf "${red}# actual: ${bold}%s${reset}\n" "$actual"
+ # Not all errors include actual/expect
+ if [[ -n "$expect" || -n "$actual" ]]; then
+ printf "${red}# expected: %s${reset}\n" "$expect"
+ printf "${red}# actual: ${bold}%s${reset}\n" "$actual"
+ fi
echo "not ok $count $testname" >>$LOG
echo " expected: $expect" >>$LOG
@@ -163,18 +166,24 @@ function test_port() {
local op="$2" # '=' or '~'
local expect="$3" # what to expect from curl output
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
- # The test is flaking with an empty result. The curl retry doesn't solve this.
- # If the result is empty sleep one second and try again.
- if [[ "$actual" == "" ]]; then
- sleep 1
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
- fi
+ # -s -S means "silent, but show errors"
+ local actual
+ actual=$(curl --retry 3 --retry-all-errors -s -S http://127.0.0.1:$port/)
local curl_rc=$?
+
if [ $curl_rc -ne 0 ]; then
- _show_ok 0 "$testname - curl failed with status $curl_rc"
-### docker-compose down >>$logfile 2>&1
-### exit 1
+ _show_ok 0 "$testname - curl (port $port) failed with status $curl_rc"
+ echo "# podman ps -a:"
+ $PODMAN_BIN --root $WORKDIR/root --runroot $WORKDIR/runroot ps -a
+ if type -p ss; then
+ echo "# ss -tulpn:"
+ ss -tulpn
+ echo "# podman unshare --rootless-cni ss -tulpn:"
+ $PODMAN_BIN --root $WORKDIR/root --runroot $WORKDIR/runroot unshare --rootless-cni ss -tulpn
+ fi
+ echo "# cat $WORKDIR/server.log:"
+ cat $WORKDIR/server.log
+ return
fi
case "$op" in
@@ -204,6 +213,7 @@ function start_service() {
cp /etc/cni/net.d/*podman*conflist $WORKDIR/cni/
$PODMAN_BIN \
+ --log-level debug \
--root $WORKDIR/root \
--runroot $WORKDIR/runroot \
--cgroup-manager=systemd \
@@ -285,6 +295,10 @@ fi
# Too hard to precompute the number of tests; just spit it out at the end.
n_tests=0
+
+# We aren't really TAP 13; this helps logformatter recognize our output as BATS
+echo "TAP version 13"
+
for t in ${tests_to_run[@]}; do
testdir="$(dirname $t)"
testname="$(basename $testdir)"
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 41afd9f75..e479b88cc 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1970,7 +1970,6 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
})
It("podman play kube applies log driver to containers", func() {
- Skip("need to verify images have correct packages for journald")
pod := getPod()
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 081bb1171..35107f0a0 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -111,4 +111,17 @@ function setup() {
is "$output" "you found me" "sample invocation of 'jq'"
}
+@test "podman --log-level recognizes log levels" {
+ run_podman 1 --log-level=telepathic info
+ is "$output" 'Log Level "telepathic" is not supported.*'
+ run_podman --log-level=trace info
+ run_podman --log-level=debug info
+ run_podman --log-level=info info
+ run_podman --log-level=warn info
+ run_podman --log-level=warning info
+ run_podman --log-level=error info
+ run_podman --log-level=fatal info
+ run_podman --log-level=panic info
+}
+
# vim: filetype=sh
diff --git a/test/system/037-runlabel.bats b/test/system/037-runlabel.bats
new file mode 100644
index 000000000..8e18f40d3
--- /dev/null
+++ b/test/system/037-runlabel.bats
@@ -0,0 +1,32 @@
+#!/usr/bin/env bats
+
+load helpers
+
+@test "podman container runlabel test" {
+ skip_if_remote "container runlabel is not supported for remote"
+ tmpdir=$PODMAN_TMPDIR/runlabel-test
+ mkdir -p $tmpdir
+ containerfile=$tmpdir/Containerfile
+ rand1=$(random_string 30)
+ rand2=$(random_string 30)
+ rand3=$(random_string 30)
+ cat >$containerfile <<EOF
+FROM $IMAGE
+LABEL INSTALL /usr/bin/podman run -t -i --rm \\\${OPT1} --privileged -v /:/host --net=host --ipc=host --pid=host -e HOST=/host -e NAME=\\\${NAME} -e IMAGE=\\\${IMAGE} -e CONFDIR=/etc/\\\${NAME} -e LOGDIR=/var/log/\\\${NAME} -e DATADIR=/var/lib/\\\${NAME} \\\${IMAGE} \\\${OPT2} /bin/install.sh \\\${OPT3}
+EOF
+
+ run_podman build -t runlabel_image $tmpdir
+
+ run_podman container runlabel --opt1=${rand1} --opt2=${rand2} --opt3=${rand3} --name test1 --display install runlabel_image
+ is "$output" "command: ${PODMAN} run -t -i --rm ${rand1} --privileged -v /:/host --net=host --ipc=host --pid=host -e HOST=/host -e NAME=test1 -e IMAGE=localhost/runlabel_image:latest -e CONFDIR=/etc/test1 -e LOGDIR=/var/log/test1 -e DATADIR=/var/lib/test1 localhost/runlabel_image:latest ${rand2} /bin/install.sh ${rand3}" "generating runlabel install command"
+
+ run_podman container runlabel --opt3=${rand3} --display install runlabel_image
+ is "$output" "command: ${PODMAN} run -t -i --rm --privileged -v /:/host --net=host --ipc=host --pid=host -e HOST=/host -e NAME=runlabel_image -e IMAGE=localhost/runlabel_image:latest -e CONFDIR=/etc/runlabel_image -e LOGDIR=/var/log/runlabel_image -e DATADIR=/var/lib/runlabel_image localhost/runlabel_image:latest /bin/install.sh ${rand3}" "generating runlabel without name and --opt1, --opt2"
+
+ run_podman 125 container runlabel --opt1=${rand1} --opt2=${rand2} --opt3=${rand3} --name test1 --display run runlabel_image
+ is "$output" "Error: cannot find the value of label: run in image: runlabel_image" "generating runlabel run command"
+
+ run_podman rmi -f runlabel_image
+}
+
+# vim: filetype=sh
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats
index 0652a97e4..a9495e350 100644
--- a/test/system/050-stop.bats
+++ b/test/system/050-stop.bats
@@ -132,6 +132,7 @@ load helpers
is "$output" "stopping" "Status of container should be 'stopping'"
run_podman kill stopme
+ run_podman wait stopme
# Exit code should be 137 as it was killed
run_podman inspect --format '{{.State.ExitCode}}' stopme
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 5a887c71e..d4017ae01 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -691,8 +691,16 @@ RUN echo $random_string
EOF
run_podman 125 build -t build_test --pull-never $tmpdir
- is "$output" ".* pull policy is .never. but .* could not be found locally" \
- "--pull-never fails with expected error message"
+ # FIXME: this is just ridiculous. Even after #10030 and #10034, Ubuntu
+ # remote *STILL* flakes this test! It fails with the correct exit status,
+ # but the error output is 'Error: stream dropped, unexpected failure'
+ # Let's just stop checking on podman-remote. As long as it exits 125,
+ # we're happy.
+ if ! is_remote; then
+ is "$output" \
+ ".* pull policy is .never. but .* could not be found locally" \
+ "--pull-never fails with expected error message"
+ fi
}
@test "podman build --logfile test" {