summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/play_kube_test.go34
-rw-r--r--test/system/035-logs.bats27
-rw-r--r--test/system/250-systemd.bats23
-rw-r--r--test/system/255-auto-update.bats6
4 files changed, 89 insertions, 1 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index ab496f0eb..5d875effd 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1289,6 +1289,40 @@ var _ = Describe("Podman play kube", func() {
Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
})
+ It("podman pod logs test", func() {
+ SkipIfRemote("podman-remote pod logs -c is mandatory for remote machine")
+ p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"}))))
+
+ err := generateKubeYaml("pod", p, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ logs := podmanTest.Podman([]string{"pod", "logs", p.Name})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).Should(Exit(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
+ })
+
+ It("podman-remote pod logs test", func() {
+ // -c or --container is required in podman-remote due to api limitation.
+ p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"}))))
+
+ err := generateKubeYaml("pod", p, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ logs := podmanTest.Podman([]string{"pod", "logs", "-c", getCtrNameInPod(p), p.Name})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).Should(Exit(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
+ })
+
It("podman play kube test restartPolicy", func() {
// podName, set, expect
testSli := [][]string{
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index 32282c8e1..a04d2ac74 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -174,4 +174,31 @@ $s_after"
_log_test_until journald
}
+function _log_test_follow() {
+ local driver=$1
+ cname=$(random_string)
+ contentA=$(random_string)
+ contentB=$(random_string)
+ contentC=$(random_string)
+
+ # Note: it seems we need at least three log lines to hit #11461.
+ run_podman run --log-driver=$driver --name $cname $IMAGE sh -c "echo $contentA; echo $contentB; echo $contentC"
+ run_podman logs -f $cname
+ is "$output" "$contentA
+$contentB
+$contentC" "logs -f on exitted container works"
+
+ run_podman rm -f $cname
+}
+
+@test "podman logs - --follow k8s-file" {
+ _log_test_follow k8s-file
+}
+
+@test "podman logs - --follow journald" {
+ # We can't use journald on RHEL as rootless: rhbz#1895105
+ skip_if_journald_unavailable
+
+ _log_test_follow journald
+}
# vim: filetype=sh
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 08fad5e7c..4578d9e60 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -136,6 +136,29 @@ function service_cleanup() {
service_cleanup
}
+# Regression test for #11438
+@test "podman generate systemd - restart policy" {
+ cname=$(random_string)
+ run_podman create --restart=always --name $cname $IMAGE
+ run_podman generate systemd --new $cname
+ is "$output" ".*Restart=always.*" "Use container's restart policy if set"
+ run_podman generate systemd --new --restart-policy=on-failure $cname
+ is "$output" ".*Restart=on-failure.*" "Override container's restart policy"
+
+ cname2=$(random_string)
+ run_podman create --restart=unless-stopped --name $cname2 $IMAGE
+ run_podman generate systemd --new $cname2
+ is "$output" ".*Restart=always.*" "unless-stopped translated to always"
+
+ cname3=$(random_string)
+ run_podman create --restart=on-failure:42 --name $cname3 $IMAGE
+ run_podman generate systemd --new $cname3
+ is "$output" ".*Restart=on-failure.*" "on-failure:xx is parsed correclty"
+ is "$output" ".*StartLimitBurst=42.*" "on-failure:xx is parsed correctly"
+
+ run_podman rm -f $cname $cname2 $cname3
+}
+
function set_listen_env() {
export LISTEN_PID="100" LISTEN_FDS="1" LISTEN_FDNAMES="listen_fdnames"
}
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
index b172bb917..bb4b5c13f 100644
--- a/test/system/255-auto-update.bats
+++ b/test/system/255-auto-update.bats
@@ -339,6 +339,8 @@ EOF
}
@test "podman auto-update using systemd" {
+ skip_if_journald_unavailable
+
generate_service alpine image
cat >$UNIT_DIR/podman-auto-update-$cname.timer <<EOF
@@ -386,7 +388,9 @@ EOF
done
if [[ -n "$failed_start" ]]; then
- die "Did not find expected string '$expect' in journalctl output for $cname"
+ echo "journalctl output:"
+ sed -e 's/^/ /' <<<"$output"
+ die "Did not find expected string '$expect' in journalctl output for $cname"
fi
_confirm_update $cname $ori_image