aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/checkpoint_image_test.go48
-rw-r--r--test/e2e/checkpoint_test.go4
-rw-r--r--test/e2e/kill_test.go2
-rw-r--r--test/e2e/logs_test.go73
-rw-r--r--test/e2e/manifest_test.go14
-rw-r--r--test/e2e/network_test.go4
-rw-r--r--test/e2e/play_kube_test.go45
-rw-r--r--test/e2e/prune_test.go6
-rw-r--r--test/e2e/restart_test.go2
-rw-r--r--test/system/030-run.bats21
-rw-r--r--test/system/251-system-service.bats8
-rw-r--r--test/system/700-play.bats10
12 files changed, 211 insertions, 26 deletions
diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go
index 5700802e8..7ab0b5ca5 100644
--- a/test/e2e/checkpoint_image_test.go
+++ b/test/e2e/checkpoint_image_test.go
@@ -295,4 +295,52 @@ var _ = Describe("Podman checkpoint", func() {
Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
+
+ It("podman run checkpoint image to restore container", func() {
+ SkipIfContainerized("FIXME: #15015. All checkpoint tests hang when containerized.")
+ // Container image must be lowercase
+ checkpointImage := "alpine-checkpoint-" + strings.ToLower(RandomString(6))
+ containerName := "alpine-container-" + RandomString(6)
+
+ // Create container
+ localRunString := []string{"run", "-d", "--name", containerName, ALPINE, "top"}
+ session := podmanTest.Podman(localRunString)
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ containerID1 := session.OutputToString()
+
+ // Checkpoint container, create checkpoint image
+ result := podmanTest.Podman([]string{"container", "checkpoint", "--create-image", checkpointImage, "--keep", containerID1})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+
+ // Remove existing container
+ result = podmanTest.Podman([]string{"rm", "-t", "1", "-f", containerName})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+
+ // Restore containers from image using `podman run`
+ result = podmanTest.Podman([]string{"run", checkpointImage})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+
+ // Check if the container is running
+ status := podmanTest.Podman([]string{"inspect", containerName, "--format={{.State.Status}}"})
+ status.WaitWithDefaultTimeout()
+ Expect(status).Should(Exit(0))
+ Expect(status.OutputToString()).To(Equal("running"))
+
+ // Clean-up
+ result = podmanTest.Podman([]string{"rm", "-t", "0", "-fa"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+
+ result = podmanTest.Podman([]string{"rmi", checkpointImage})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
})
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index a33936549..b0c1d36d3 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -1170,10 +1170,6 @@ var _ = Describe("Podman checkpoint", func() {
share := share // copy into local scope, for use inside function
It(testName, func() {
- if podmanTest.Host.Distribution == "ubuntu" && IsRemote() {
- Skip("FIXME: #15018. Cannot restore --pod under cgroupsV1 and remote")
- }
-
if !criu.CheckForCriu(criu.PodCriuVersion) {
Skip("CRIU is missing or too old.")
}
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index 30c82c45d..d789a6595 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -201,7 +201,7 @@ var _ = Describe("Podman kill", func() {
Expect(wait).Should(Exit(0))
})
- It("podman stop --all", func() {
+ It("podman kill --all", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index c680cae2a..93ef54c3a 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -391,6 +391,78 @@ var _ = Describe("Podman logs", func() {
// see comment above
Expect(string(logs.Out.Contents())).To(Equal(content))
})
+
+ It("podman pod logs -l with newer container created: "+log, func() {
+ skipIfJournaldInContainer()
+
+ podName := "testPod"
+ containerName1 := "container1"
+ containerName2 := "container2"
+ containerName3 := "container3"
+
+ testPod := podmanTest.Podman([]string{"pod", "create", fmt.Sprintf("--name=%s", podName)})
+ testPod.WaitWithDefaultTimeout()
+ Expect(testPod).To(Exit(0))
+
+ log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName1, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log1"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1).To(Exit(0))
+
+ log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName2, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log2"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2).To(Exit(0))
+
+ ctr := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName3, "-d", BB, "date"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"pod", "logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ if IsRemote() {
+ Expect(results).To(Exit(125))
+ } else {
+ Expect(results).To(Exit(0))
+ podOutput := results.OutputToString()
+
+ results = podmanTest.Podman([]string{"logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ ctrOutput := results.OutputToString()
+
+ Expect(podOutput).ToNot(Equal(ctrOutput))
+ }
+ })
+
+ It("podman pod logs -l: "+log, func() {
+ skipIfJournaldInContainer()
+
+ podName := "testPod"
+ containerName1 := "container1"
+ containerName2 := "container2"
+
+ testPod := podmanTest.Podman([]string{"pod", "create", fmt.Sprintf("--name=%s", podName)})
+ testPod.WaitWithDefaultTimeout()
+ Expect(testPod).To(Exit(0))
+
+ log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName1, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log1"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1).To(Exit(0))
+
+ log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName2, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log2"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"pod", "logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ if IsRemote() {
+ Expect(results).To(Exit(125))
+ } else {
+ Expect(results).To(Exit(0))
+ output := results.OutputToString()
+ Expect(output).To(ContainSubstring("log1"))
+ Expect(output).To(ContainSubstring("log2"))
+ }
+ })
}
It("using journald for container with container tag", func() {
@@ -490,4 +562,5 @@ var _ = Describe("Podman logs", func() {
Expect(output[0]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
Expect(output[1]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
})
+
})
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 404f2cd3a..b0a5e7d03 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -165,20 +165,6 @@ var _ = Describe("Podman manifest", func() {
))
})
- It("add --annotation", func() {
- session := podmanTest.Podman([]string{"manifest", "create", "foo"})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "foo", imageList})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(ContainSubstring(`"annotations"`))
- Expect(session.OutputToString()).To(ContainSubstring(`"hoge": "fuga"`))
- })
-
It("add --os", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index b2f50ca55..4366d84aa 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -706,7 +706,7 @@ var _ = Describe("Podman network", func() {
})
It("podman network prune --filter", func() {
- // set custom cni directory to prevent flakes
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
podmanTest.NetworkConfigDir = tempdir
if IsRemote() {
podmanTest.RestartRemoteService()
@@ -754,7 +754,7 @@ var _ = Describe("Podman network", func() {
})
It("podman network prune", func() {
- // set custom cni directory to prevent flakes
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
podmanTest.NetworkConfigDir = tempdir
if IsRemote() {
podmanTest.RestartRemoteService()
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 651cb1074..97823e232 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2604,6 +2604,36 @@ spec:
Expect(st.Mode().IsDir()).To(Equal(true))
})
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and non-existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // the full path should have been created
+ st, err := os.Stat(hostPathLocation)
+ Expect(err).To(BeNil())
+ Expect(st.Mode().IsDir()).To(Equal(true))
+ })
+
+ It("podman play kube test with DirectoryOrCreate HostPath type volume and existent directory path", func() {
+ hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2")
+ Expect(os.MkdirAll(hostPathLocation, os.ModePerm)).To(BeNil())
+
+ pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+ })
+
It("podman play kube test with Socket HostPath type volume should fail if not socket", func() {
hostPathLocation := filepath.Join(tempdir, "file")
f, err := os.Create(hostPathLocation)
@@ -3000,6 +3030,21 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
Expect(logs.OutputToString()).To(Equal(netns))
})
+ It("podman play kube test with kube default network", func() {
+ pod := getPod()
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.Networks }}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal("[podman-default-kube-network]"))
+ })
+
It("podman play kube persistentVolumeClaim", func() {
volName := "myvol"
volDevice := "tmpfs"
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 0b1d68aea..e91569231 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -259,6 +259,12 @@ var _ = Describe("Podman prune", func() {
})
It("podman system prune networks", func() {
+ // set custom network directory to prevent flakes since the dir is shared with all tests by default
+ podmanTest.NetworkConfigDir = tempdir
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
// Create new network.
session := podmanTest.Podman([]string{"network", "create", "test"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 87d20a2e6..effb716a8 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -321,7 +321,7 @@ var _ = Describe("Podman restart", func() {
Expect(result.ErrorToString()).To(ContainSubstring("cannot be used together"))
})
- It("podman pause --filter", func() {
+ It("podman restart --filter", func() {
session1 := podmanTest.RunTopContainer("")
session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0))
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 6847880ab..8de1625b5 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -548,11 +548,23 @@ json-file | f
# prior to #8623 `podman run` would error out on untagged images with:
# Error: both RootfsImageName and RootfsImageID must be set if either is set: invalid argument
run_podman untag $IMAGE
- run_podman run --rm $imageID ls
+ run_podman run --rm $randomname $imageID true
run_podman tag $imageID $IMAGE
}
+@test "podman inspect includes image data" {
+ randomname=$(random_string 30)
+
+ run_podman inspect $IMAGE --format "{{.ID}} {{.Digest}}"
+ expected="$IMAGE $output"
+
+ run_podman run --name $randomname $IMAGE true
+ run_podman container inspect $randomname --format "{{.ImageName}} {{.Image}} {{.ImageDigest}}"
+ is "$output" "$expected"
+ run_podman rm -f -t0 $randomname
+}
+
@test "Verify /run/.containerenv exist" {
# Nonprivileged container: file exists, but must be empty
run_podman run --rm $IMAGE stat -c '%s' /run/.containerenv
@@ -620,10 +632,15 @@ json-file | f
run_podman image mount $IMAGE
romount="$output"
+ randomname=$(random_string 30)
# FIXME FIXME FIXME: Remove :O once (if) #14504 is fixed!
- run_podman run --rm --rootfs $romount:O echo "Hello world"
+ run_podman run --name=$randomname --rootfs $romount:O echo "Hello world"
is "$output" "Hello world"
+ run_podman container inspect $randomname --format "{{.ImageDigest}}"
+ is "$output" "" "Empty image digest for --rootfs container"
+
+ run_podman rm -f -t0 $randomname
run_podman image unmount $IMAGE
fi
}
diff --git a/test/system/251-system-service.bats b/test/system/251-system-service.bats
index 197d1cb18..3af42b455 100644
--- a/test/system/251-system-service.bats
+++ b/test/system/251-system-service.bats
@@ -14,6 +14,14 @@ function teardown() {
basic_teardown
}
+@test "podman systerm service <bad_scheme_uri> returns error" {
+ skip_if_remote "podman system service unavailable over remote"
+ run_podman 125 system service localhost:9292
+ is "$output" "Error: API Service endpoint scheme \"localhost\" is not supported. Try tcp://localhost:9292 or unix:/localhost:9292"
+
+ run_podman 125 system service myunix.sock
+ is "$output" "Error: API Service endpoint scheme \"\" is not supported. Try tcp://myunix.sock or unix:/myunix.sock"
+}
@test "podman-system-service containers survive service stop" {
skip_if_remote "podman system service unavailable over remote"
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 578d28394..5f3eb1ef2 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -165,8 +165,14 @@ EOF
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
- run_podman 125 kube play --network host $PODMAN_TMPDIR/test.yaml
- is "$output" ".*invalid value passed to --network: bridge or host networking must be configured in YAML" "podman plan-network should fail with --network host"
+ run_podman kube play --network host $PODMAN_TMPDIR/test.yaml
+ is "$output" "Pod:.*" "podman kube play should work with --network host"
+
+ run_podman pod inspect --format "{{.InfraConfig.HostNetwork}}" test_pod
+ is "$output" "true" ".InfraConfig.HostNetwork"
+ run_podman stop -a -t 0
+ run_podman pod rm -t 0 -f test_pod
+
run_podman kube play --network slirp4netns:port_handler=slirp4netns $PODMAN_TMPDIR/test.yaml
run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
infraID="$output"