diff options
Diffstat (limited to 'test')
126 files changed, 710 insertions, 459 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 693c34ced..a650cf958 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -45,6 +45,13 @@ t POST "images/create?fromImage=alpine" '' 200 .error=null .status~".*Download c t POST "images/create?fromImage=alpine&tag=latest" '' 200 +# Make sure that new images are pulled +old_iid=$(podman image inspect --format "{{.ID}}" docker.io/library/alpine:latest) +podman rmi -f docker.io/library/alpine:latest +podman tag $IMAGE docker.io/library/alpine:latest +t POST "images/create?fromImage=alpine" '' 200 .error=null .status~".*$old_iid.*" +podman untag $IMAGE docker.io/library/alpine:latest + t POST "images/create?fromImage=quay.io/libpod/alpine&tag=sha256:fa93b01658e3a5a1686dc3ae55f170d8de487006fb53a28efcd12ab0710a2e5f" '' 200 # Display the image history diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 0da196e46..a99e9a184 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -63,7 +63,7 @@ cid=$(jq -r '.Id' <<<"$output") # Prior to the fix in #6835, this would fail 500 "args must not be empty" t POST libpod/containers/${cid}/start '' 204 # Container should exit almost immediately. Wait for it, confirm successful run -t POST libpod/containers/${cid}/wait '' 200 '0' +t POST "libpod/containers/${cid}/wait?condition=stopped&condition=exited" '' 200 '0' t GET libpod/containers/${cid}/json 200 \ .Id=$cid \ .State.Status~\\\(exited\\\|stopped\\\) \ diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go index 0c27e05c7..146ff27a5 100644 --- a/test/e2e/attach_test.go +++ b/test/e2e/attach_test.go @@ -5,7 +5,7 @@ import ( "syscall" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index bdd35db8f..c733db61c 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/containers/buildah" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 3270ce685..9d0049910 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -6,8 +6,8 @@ import ( "os/exec" "strings" - "github.com/containers/podman/v2/pkg/criu" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/criu" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index 8760978fd..0d3f2bed7 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index d033cc646..70ffdebea 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -15,11 +15,11 @@ import ( "testing" "time" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/inspect" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/inspect" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage" "github.com/containers/storage/pkg/reexec" "github.com/containers/storage/pkg/stringid" @@ -436,13 +436,20 @@ func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSe // BuildImage uses podman build and buildah to build an image // called imageName based on a string dockerfile -func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) { +func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) string { dockerfilePath := filepath.Join(p.TempDir, "Dockerfile") err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755) Expect(err).To(BeNil()) - session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir}) + cmd := []string{"build", "--layers=" + layers, "--file", dockerfilePath} + if len(imageName) > 0 { + cmd = append(cmd, []string{"-t", imageName}...) + } + cmd = append(cmd, p.TempDir) + session := p.Podman(cmd) session.Wait(240) Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString())) + output := session.OutputToStringArray() + return output[len(output)-1] } // PodmanPID execs podman and returns its PID diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go index e84fd9f2e..840f13e3d 100644 --- a/test/e2e/container_inspect_test.go +++ b/test/e2e/container_inspect_test.go @@ -3,8 +3,8 @@ package integration import ( "os" - "github.com/containers/podman/v2/pkg/annotations" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/annotations" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index c78c93b8c..9c2260c5f 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index f81323847..c0fb3f887 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -7,7 +7,7 @@ import ( "os/user" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go index 698bbf976..340ea31f3 100644 --- a/test/e2e/create_staticip_test.go +++ b/test/e2e/create_staticip_test.go @@ -4,8 +4,8 @@ import ( "os" "time" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/create_staticmac_test.go b/test/e2e/create_staticmac_test.go index 4c8f371a4..1df93553d 100644 --- a/test/e2e/create_staticmac_test.go +++ b/test/e2e/create_staticmac_test.go @@ -3,8 +3,8 @@ package integration import ( "os" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 67c08ac09..43da95a9d 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -8,7 +8,7 @@ import ( "runtime" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index 6a71f4d70..4370a2127 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -4,7 +4,7 @@ import ( "os" "sort" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 0c7a1bd66..4dbbe9dd8 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -8,7 +8,7 @@ import ( "sync" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index b180d881a..2ffb5cd2e 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -5,7 +5,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go index 306e8c250..f0a55dd94 100644 --- a/test/e2e/exists_test.go +++ b/test/e2e/exists_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go index 4faacd626..61aebb5f2 100644 --- a/test/e2e/export_test.go +++ b/test/e2e/export_test.go @@ -4,7 +4,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index cd949c666..d7c697f28 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strconv" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/ghodss/yaml" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go index 606d756b0..d164b6021 100644 --- a/test/e2e/generate_systemd_test.go +++ b/test/e2e/generate_systemd_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -235,6 +235,29 @@ var _ = Describe("Podman generate systemd", func() { session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring(" pod create ")) + }) + + It("podman generate systemd --new=false pod", func() { + n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"}) + n.WaitWithDefaultTimeout() + Expect(n.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=false", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).NotTo(ContainSubstring(" pod create ")) + }) + + It("podman generate systemd --new=true pod", func() { + n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"}) + n.WaitWithDefaultTimeout() + Expect(n.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=true", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring(" pod create ")) }) It("podman generate systemd --container-prefix con", func() { diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index 403f15fa7..ed7958323 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -5,7 +5,7 @@ import ( "os" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go index 1c57c60de..e2cf62d9a 100644 --- a/test/e2e/history_test.go +++ b/test/e2e/history_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go index 57739419c..704a78685 100644 --- a/test/e2e/image_sign_test.go +++ b/test/e2e/image_sign_test.go @@ -6,7 +6,7 @@ import ( "os/exec" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 64d2ee3f3..29be505b7 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -6,7 +6,7 @@ import ( "sort" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/docker/go-units" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index bd465bf38..1f1b23bd0 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -4,7 +4,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index bc4e6212b..3ce294b30 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -8,7 +8,7 @@ import ( "os/user" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go index 3e64cfda2..d283e1f9a 100644 --- a/test/e2e/init_test.go +++ b/test/e2e/init_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index 12bc886a8..d417fc49d 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -4,7 +4,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index c1c1b003e..a9f21fa70 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -51,6 +51,19 @@ var _ = Describe("Podman kill", func() { Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) + It("podman container kill a running container by short id", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + + result := podmanTest.Podman([]string{"container", "kill", cid[:5]}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(result.OutputToString()).To(Equal(cid[:5])) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + It("podman kill a running container by id", func() { session := podmanTest.RunTopContainer("") session.WaitWithDefaultTimeout() diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go index da57bb4c0..a26765ee9 100644 --- a/test/e2e/libpod_suite_remote_test.go +++ b/test/e2e/libpod_suite_remote_test.go @@ -15,7 +15,7 @@ import ( "syscall" "time" - "github.com/containers/podman/v2/pkg/rootless" + "github.com/containers/podman/v3/pkg/rootless" "github.com/onsi/ginkgo" ) diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index ffbb9b44f..267f18b0a 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index a2e88ecd2..99876de29 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" "github.com/onsi/ginkgo/config" . "github.com/onsi/gomega" diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index b370aeec1..8f695279a 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -6,7 +6,7 @@ import ( "os/exec" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" @@ -36,345 +36,341 @@ var _ = Describe("Podman logs", func() { }) - It("all lines", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - cid := logc.OutputToString() - results := podmanTest.Podman([]string{"logs", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("tail two lines", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "2", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(2)) - }) - - It("tail zero lines", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "0", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(0)) - }) - - It("tail 800 lines", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "i=1; while [ \"$i\" -ne 1000 ]; do echo \"line $i\"; i=$((i + 1)); done"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "800", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(800)) - }) - - It("tail 2 lines with timestamps", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(2)) - }) - - It("since time 2017-08-07", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("since duration 10m", func() { - logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--since", "10m", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("latest and container name should fail", func() { - results := podmanTest.Podman([]string{"logs", "-l", "foobar"}) - results.WaitWithDefaultTimeout() - Expect(results).To(ExitWithError()) - }) - - It("two containers showing short container IDs", func() { - SkipIfRemote("FIXME: podman-remote logs does not support showing two containers at the same time") - log1 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - log1.WaitWithDefaultTimeout() - Expect(log1.ExitCode()).To(Equal(0)) - cid1 := log1.OutputToString() - - log2 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - log2.WaitWithDefaultTimeout() - Expect(log2.ExitCode()).To(Equal(0)) - cid2 := log2.OutputToString() - - results := podmanTest.Podman([]string{"logs", cid1, cid2}) - results.WaitWithDefaultTimeout() - Expect(results).Should(Exit(0)) - - output := results.OutputToStringArray() - Expect(len(output)).To(Equal(6)) - Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue()) - }) - - It("podman logs on a created container should result in 0 exit code", func() { - session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE}) - session.WaitWithDefaultTimeout() - Expect(session).To(Exit(0)) - - results := podmanTest.Podman([]string{"logs", "log"}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - }) + for _, log := range []string{"k8s-file", "journald", "json-file"} { + It("all lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + cid := logc.OutputToString() + results := podmanTest.Podman([]string{"logs", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("tail two lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "2", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(2)) + }) + + It("tail zero lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "0", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(0)) + }) + + It("tail 800 lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "i=1; while [ \"$i\" -ne 1000 ]; do echo \"line $i\"; i=$((i + 1)); done"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "800", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(800)) + }) + + It("tail 2 lines with timestamps: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(2)) + }) + + It("since time 2017-08-07: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("since duration 10m: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--since", "10m", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("latest and container name should fail: "+log, func() { + results := podmanTest.Podman([]string{"logs", "-l", "foobar"}) + results.WaitWithDefaultTimeout() + Expect(results).To(ExitWithError()) + }) + + It("two containers showing short container IDs: "+log, func() { + SkipIfRemote("FIXME: podman-remote logs does not support showing two containers at the same time") + log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + log1.WaitWithDefaultTimeout() + Expect(log1.ExitCode()).To(Equal(0)) + cid1 := log1.OutputToString() + + log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + log2.WaitWithDefaultTimeout() + Expect(log2.ExitCode()).To(Equal(0)) + cid2 := log2.OutputToString() + + results := podmanTest.Podman([]string{"logs", cid1, cid2}) + results.WaitWithDefaultTimeout() + Expect(results).Should(Exit(0)) + + output := results.OutputToStringArray() + Expect(len(output)).To(Equal(6)) + Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue()) + }) + + It("podman logs on a created container should result in 0 exit code: "+log, func() { + session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session).To(Exit(0)) + + results := podmanTest.Podman([]string{"logs", "log"}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + }) + + It("for container: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + Expect(results.OutputToString()).To(Equal("podman podman podman")) + }) + + It("tail two lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + results := podmanTest.Podman([]string{"logs", "--tail", "2", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(2)) + }) + + It("tail 99 lines: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "99", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("tail 2 lines with timestamps: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(2)) + }) + + It("since time 2017-08-07: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("with duration 10m: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--since", "10m", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("streaming output: "+log, func() { + containerName := "logs-f-rm" + + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--rm", "--name", containerName, "-dt", ALPINE, "sh", "-c", "echo podman; sleep 1; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + results := podmanTest.Podman([]string{"logs", "-f", containerName}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + + // TODO: we should actually check for two podman lines, + // but as of 2020-06-17 there's a race condition in which + // 'logs -f' may not catch all output from a container + Expect(results.OutputToString()).To(ContainSubstring("podman")) + + // Container should now be terminatING or terminatED, but we + // have no guarantee of which: 'logs -f' does not necessarily + // wait for cleanup. Run 'inspect' and accept either state. + inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Status}}", containerName}) + inspect.WaitWithDefaultTimeout() + if inspect.ExitCode() == 0 { + Expect(inspect.OutputToString()).To(Equal("exited")) + // TODO: add 2-second wait loop to confirm cleanup + } else { + Expect(inspect.ErrorToString()).To(ContainSubstring("no such container")) + } + }) + + It("podman logs with log-driver=none errors: "+log, func() { + ctrName := "logsctr" + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", ctrName, "-d", "--log-driver", "none", ALPINE, "top"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + logs := podmanTest.Podman([]string{"logs", "-f", ctrName}) + logs.WaitWithDefaultTimeout() + Expect(logs).To(Not(Exit(0))) + }) + + It("follow output stopped container: "+log, func() { + containerName := "logs-f" + + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName, "-d", ALPINE, "true"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + results := podmanTest.Podman([]string{"logs", "-f", containerName}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + }) + + It("using container with container log-size: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--log-opt=max-size=10k", "-d", ALPINE, "sh", "-c", "echo podman podman podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + wait := podmanTest.Podman([]string{"wait", cid}) + wait.WaitWithDefaultTimeout() + Expect(wait).To(Exit(0)) + + inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.HostConfig.LogConfig.Size}}", cid}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).To(Exit(0)) + Expect(inspect.OutputToString()).To(Equal("10kB")) + + results := podmanTest.Podman([]string{"logs", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(results.OutputToString()).To(Equal("podman podman podman")) + }) + + It("Make sure logs match expected length: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + wait := podmanTest.Podman([]string{"wait", "test"}) + wait.WaitWithDefaultTimeout() + Expect(wait).To(Exit(0)) + + results := podmanTest.Podman([]string{"logs", "test"}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + outlines := results.OutputToStringArray() + Expect(len(outlines)).To(Equal(2)) + Expect(outlines[0]).To(Equal("1\r")) + Expect(outlines[1]).To(Equal("2\r")) + }) + + It("podman logs test stdout and stderr: "+log, func() { + cname := "log-test" + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", cname, ALPINE, "sh", "-c", "echo stdout; echo stderr >&2"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + + wait := podmanTest.Podman([]string{"wait", cname}) + wait.WaitWithDefaultTimeout() + Expect(wait).To(Exit(0)) + + results := podmanTest.Podman([]string{"logs", cname}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(results.OutputToString()).To(Equal("stdout")) + Expect(results.ErrorToString()).To(Equal("stderr")) + }) + } It("using journald for container with container tag", func() { - Skip("need to verify images have correct packages for journald") + SkipIfInContainer("journalctl inside a container doesn't work correctly") logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "--log-opt=tag={{.ImageName}}", "-d", ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"}) logc.WaitWithDefaultTimeout() Expect(logc).To(Exit(0)) cid := logc.OutputToString() - wait := podmanTest.Podman([]string{"wait", "-l"}) + wait := podmanTest.Podman([]string{"wait", cid}) wait.WaitWithDefaultTimeout() Expect(wait).To(Exit(0)) - cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid)) + cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid)) out, err := cmd.CombinedOutput() Expect(err).To(BeNil()) Expect(string(out)).To(ContainSubstring("alpine")) }) - It("using journald for container name", func() { - Skip("need to verify images have correct packages for journald") + It("using journald container name", func() { + SkipIfInContainer("journalctl inside a container doesn't work correctly") containerName := "inside-journal" logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-d", "--name", containerName, ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"}) logc.WaitWithDefaultTimeout() Expect(logc).To(Exit(0)) cid := logc.OutputToString() - wait := podmanTest.Podman([]string{"wait", "-l"}) + wait := podmanTest.Podman([]string{"wait", cid}) wait.WaitWithDefaultTimeout() Expect(wait).To(Exit(0)) - cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid)) + cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid)) out, err := cmd.CombinedOutput() Expect(err).To(BeNil()) Expect(string(out)).To(ContainSubstring(containerName)) }) - - It("using journald for container", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - Expect(results.OutputToString()).To(Equal("podman podman podman")) - }) - - It("using journald tail two lines", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - results := podmanTest.Podman([]string{"logs", "--tail", "2", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(2)) - }) - - It("using journald tail 99 lines", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "99", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("using journald tail 2 lines with timestamps", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(2)) - }) - - It("using journald since time 2017-08-07", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("using journald with duration 10m", func() { - Skip("need to verify images have correct packages for journald") - logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - results := podmanTest.Podman([]string{"logs", "--since", "10m", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(len(results.OutputToStringArray())).To(Equal(3)) - }) - - It("streaming output", func() { - containerName := "logs-f-rm" - - logc := podmanTest.Podman([]string{"run", "--rm", "--name", containerName, "-dt", ALPINE, "sh", "-c", "echo podman; sleep 1; echo podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - results := podmanTest.Podman([]string{"logs", "-f", containerName}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - - // TODO: we should actually check for two podman lines, - // but as of 2020-06-17 there's a race condition in which - // 'logs -f' may not catch all output from a container - Expect(results.OutputToString()).To(ContainSubstring("podman")) - - // Container should now be terminatING or terminatED, but we - // have no guarantee of which: 'logs -f' does not necessarily - // wait for cleanup. Run 'inspect' and accept either state. - inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Status}}", containerName}) - inspect.WaitWithDefaultTimeout() - if inspect.ExitCode() == 0 { - Expect(inspect.OutputToString()).To(Equal("exited")) - // TODO: add 2-second wait loop to confirm cleanup - } else { - Expect(inspect.ErrorToString()).To(ContainSubstring("no such container")) - } - }) - - It("podman logs with log-driver=none errors", func() { - ctrName := "logsctr" - logc := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--log-driver", "none", ALPINE, "top"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - logs := podmanTest.Podman([]string{"logs", "-f", ctrName}) - logs.WaitWithDefaultTimeout() - Expect(logs).To(Not(Exit(0))) - }) - - It("follow output stopped container", func() { - containerName := "logs-f" - - logc := podmanTest.Podman([]string{"run", "--name", containerName, "-d", ALPINE, "true"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - results := podmanTest.Podman([]string{"logs", "-f", containerName}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - }) - - It("using container with container log-size", func() { - logc := podmanTest.Podman([]string{"run", "--log-opt=max-size=10k", "-d", ALPINE, "sh", "-c", "echo podman podman podman"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - - wait := podmanTest.Podman([]string{"wait", cid}) - wait.WaitWithDefaultTimeout() - Expect(wait).To(Exit(0)) - - inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.HostConfig.LogConfig.Size}}", cid}) - inspect.WaitWithDefaultTimeout() - Expect(inspect).To(Exit(0)) - Expect(inspect.OutputToString()).To(Equal("10kB")) - - results := podmanTest.Podman([]string{"logs", cid}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(results.OutputToString()).To(Equal("podman podman podman")) - }) - - It("Make sure logs match expected length", func() { - logc := podmanTest.Podman([]string{"run", "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - wait := podmanTest.Podman([]string{"wait", "test"}) - wait.WaitWithDefaultTimeout() - Expect(wait).To(Exit(0)) - - results := podmanTest.Podman([]string{"logs", "test"}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - outlines := results.OutputToStringArray() - Expect(len(outlines)).To(Equal(2)) - Expect(outlines[0]).To(Equal("1\r")) - Expect(outlines[1]).To(Equal("2\r")) - }) - - It("podman logs test stdout and stderr", func() { - cname := "log-test" - logc := podmanTest.Podman([]string{"run", "--name", cname, ALPINE, "sh", "-c", "echo stdout; echo stderr >&2"}) - logc.WaitWithDefaultTimeout() - Expect(logc).To(Exit(0)) - - wait := podmanTest.Podman([]string{"wait", cname}) - wait.WaitWithDefaultTimeout() - Expect(wait).To(Exit(0)) - - results := podmanTest.Podman([]string{"logs", cname}) - results.WaitWithDefaultTimeout() - Expect(results).To(Exit(0)) - Expect(results.OutputToString()).To(Equal("stdout")) - Expect(results.ErrorToString()).To(Equal("stderr")) - }) }) diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index e6ac83aea..18be97a89 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -5,7 +5,7 @@ import ( "path/filepath" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go index c410a2507..502bdef4e 100644 --- a/test/e2e/mount_rootless_test.go +++ b/test/e2e/mount_rootless_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go index c9274553b..ee77f2984 100644 --- a/test/e2e/mount_test.go +++ b/test/e2e/mount_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go index 951e98dfc..0c451d6cd 100644 --- a/test/e2e/namespace_test.go +++ b/test/e2e/namespace_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/negative_test.go b/test/e2e/negative_test.go index 9c879fb8b..c3cef2e8e 100644 --- a/test/e2e/negative_test.go +++ b/test/e2e/negative_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go index cc23b10c1..ab42a592f 100644 --- a/test/e2e/network_connect_disconnect_test.go +++ b/test/e2e/network_connect_disconnect_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index 1bf2a2691..ef3be8e22 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -8,8 +8,8 @@ import ( "strings" cniversion "github.com/containernetworking/cni/pkg/version" - "github.com/containers/podman/v2/libpod/network" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/libpod/network" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 083d2a49a..a7eb6e629 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -6,8 +6,8 @@ import ( "strings" "time" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index a90ffcc87..01ad7c071 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 2e5c72b0e..9260d6cd2 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -10,7 +10,7 @@ import ( "strings" "text/template" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/opencontainers/selinux/go-selinux" diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index e57712f62..a70d9f13f 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -501,4 +501,18 @@ entrypoint ["/fromimage"] Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo")) Expect(len(session.OutputToStringArray())).To(Equal(1)) }) + + It("podman pod create --infra-image w/untagged image", func() { + podmanTest.AddImageToRWStore(ALPINE) + dockerfile := `FROM quay.io/libpod/alpine:latest +ENTRYPOINT ["sleep","99999"] + ` + // This builds a none/none image + iid := podmanTest.BuildImage(dockerfile, "", "true") + + create := podmanTest.Podman([]string{"pod", "create", "--infra-image", iid}) + create.WaitWithDefaultTimeout() + Expect(create.ExitCode()).To(BeZero()) + }) + }) diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index 452a3de21..09f0d4e33 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -4,7 +4,7 @@ import ( "os" "strconv" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index d9c4a393a..036b08570 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -4,8 +4,8 @@ import ( "encoding/json" "os" - "github.com/containers/podman/v2/libpod/define" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/libpod/define" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 06d244f99..92dcad292 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index 0c1b39f38..da3b106fa 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go index 20b8bdb39..ce93db63c 100644 --- a/test/e2e/pod_pod_namespaces_test.go +++ b/test/e2e/pod_pod_namespaces_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index d1ebf7249..2def95308 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index c20cb44e7..c5c0827bc 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -5,7 +5,7 @@ import ( "os" "sort" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index c6b1a0d46..006421b93 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 40a903cd0..6d710f020 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index e14796ab3..5838f3310 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index 073d4752b..2064cdc9f 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index 30a5632d0..45e2f86a6 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index e191b44fc..9d9c138c4 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -5,7 +5,7 @@ import ( "os" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go index 4aaf2cbc1..e9bbc2adc 100644 --- a/test/e2e/port_test.go +++ b/test/e2e/port_test.go @@ -5,7 +5,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index f19627170..73da77417 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 225bd538e..ac0910a83 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" "github.com/docker/go-units" . "github.com/onsi/ginkgo" @@ -350,6 +350,21 @@ var _ = Describe("Podman ps", func() { Expect(session).To(ExitWithError()) }) + It("podman --format by size", func() { + session := podmanTest.Podman([]string{"create", "busybox", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"ps", "-a", "--format", "{{.Size}}"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.ErrorToString()).To(ContainSubstring("Size format requires --size option")) + }) + It("podman --sort by size", func() { session := podmanTest.Podman([]string{"create", "busybox", "ls"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index d47a3e47a..5308548f1 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -7,7 +7,7 @@ import ( "runtime" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index 00b5802a3..cc7c67941 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go index 7affbaf56..f19413221 100644 --- a/test/e2e/rename_test.go +++ b/test/e2e/rename_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index bfe9563ea..dc8e64e63 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -4,7 +4,7 @@ import ( "os" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index 4c50a61ef..788d14141 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 257570ea7..d8367d636 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -5,7 +5,7 @@ import ( "os" "sync" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go index 0faf0b496..63c52451f 100644 --- a/test/e2e/run_apparmor_test.go +++ b/test/e2e/run_apparmor_test.go @@ -9,7 +9,7 @@ import ( "path/filepath" "github.com/containers/common/pkg/apparmor" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go index 35628d44b..d68b1bb5f 100644 --- a/test/e2e/run_cgroup_parent_test.go +++ b/test/e2e/run_cgroup_parent_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go index 5f6c9007a..2dfaf1329 100644 --- a/test/e2e/run_cleanup_test.go +++ b/test/e2e/run_cleanup_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go index d8b57c230..2f4452ba4 100644 --- a/test/e2e/run_cpu_test.go +++ b/test/e2e/run_cpu_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index 1c2602631..5a32ed827 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go index c8996c5e8..05f8c3f99 100644 --- a/test/e2e/run_dns_test.go +++ b/test/e2e/run_dns_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go index cac3d759d..ddad89c85 100644 --- a/test/e2e/run_entrypoint_test.go +++ b/test/e2e/run_entrypoint_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -43,6 +43,18 @@ CMD [] Expect(session.ExitCode()).To(Equal(125)) }) + It("podman run entrypoint == [\"\"]", func() { + dockerfile := `FROM quay.io/libpod/alpine:latest +ENTRYPOINT [""] +CMD [] +` + podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false") + session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal("hello")) + }) + It("podman run entrypoint", func() { dockerfile := `FROM quay.io/libpod/alpine:latest ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go index 9882b936a..83d8e8da6 100644 --- a/test/e2e/run_env_test.go +++ b/test/e2e/run_env_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go index 0579e29fa..3d969cbc2 100644 --- a/test/e2e/run_exit_test.go +++ b/test/e2e/run_exit_test.go @@ -3,8 +3,8 @@ package integration import ( "os" - "github.com/containers/podman/v2/libpod/define" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/libpod/define" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index ad3a2b54f..cb13993f4 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -2,8 +2,9 @@ package integration import ( "os" + "strconv" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -90,4 +91,27 @@ var _ = Describe("Podman run memory", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(Equal("41943040")) }) + + It("podman run kernel-memory test", func() { + if podmanTest.Host.Distribution == "ubuntu" { + Skip("Unable to perform test on Ubuntu distributions due to memory management") + } + var session *PodmanSessionIntegration + if CGROUPSV2 { + session = podmanTest.Podman([]string{"run", "--memory", "256m", "--memory-swap", "-1", ALPINE, "cat", "/sys/fs/cgroup/memory.swap.max"}) + } else { + session = podmanTest.Podman([]string{"run", "--cgroupns=private", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"}) + } + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + output := session.OutputToString() + Expect(err).To(BeNil()) + if CGROUPSV2 { + Expect(output).To(Equal("max")) + } else { + crazyHighNumber, err := strconv.ParseInt(output, 10, 64) + Expect(err).To(BeZero()) + Expect(crazyHighNumber).To(BeNumerically(">", 936854771712)) + } + }) }) diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 676f24e5d..a6237a49a 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -5,7 +5,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go index 29d2d4395..c72891107 100644 --- a/test/e2e/run_ns_test.go +++ b/test/e2e/run_ns_test.go @@ -5,7 +5,7 @@ import ( "os/exec" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go index e7b86c68b..12b6c64df 100644 --- a/test/e2e/run_passwd_test.go +++ b/test/e2e/run_passwd_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go index 48f9ea76e..33b3b85c5 100644 --- a/test/e2e/run_privileged_test.go +++ b/test/e2e/run_privileged_test.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/syndtr/gocapability/capability" diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go index 85621a762..c996bdb25 100644 --- a/test/e2e/run_restart_test.go +++ b/test/e2e/run_restart_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go index 7d04cc60a..ed1cdeecd 100644 --- a/test/e2e/run_seccomp_test.go +++ b/test/e2e/run_seccomp_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go index 0c5621e3f..a2e0b2aab 100644 --- a/test/e2e/run_security_labels_test.go +++ b/test/e2e/run_security_labels_test.go @@ -4,7 +4,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go index 2e9d38e2d..8c712b1be 100644 --- a/test/e2e/run_selinux_test.go +++ b/test/e2e/run_selinux_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/opencontainers/selinux/go-selinux" diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go index 58b8d04e5..f601bee72 100644 --- a/test/e2e/run_signal_test.go +++ b/test/e2e/run_signal_test.go @@ -9,8 +9,8 @@ import ( "syscall" "time" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "golang.org/x/sys/unix" diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index aeb462ae9..bff142b12 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -6,7 +6,7 @@ import ( "os" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 18db63c15..c28086fe8 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -11,7 +11,7 @@ import ( "syscall" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" "github.com/mrunalp/fileutils" . "github.com/onsi/ginkgo" @@ -47,6 +47,29 @@ var _ = Describe("Podman run", func() { Expect(session.ExitCode()).To(Equal(0)) }) + It("podman run check /run/.containerenv", func() { + session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/run/.containerenv"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal("")) + + session = podmanTest.Podman([]string{"run", "--privileged", "--name=test1", ALPINE, "cat", "/run/.containerenv"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("name=\"test1\"")) + Expect(session.OutputToString()).To(ContainSubstring("image=\"" + ALPINE + "\"")) + + session = podmanTest.Podman([]string{"run", "-v", "/:/host", ALPINE, "cat", "/run/.containerenv"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1")) + + session = podmanTest.Podman([]string{"run", "-v", "/:/host", "--privileged", ALPINE, "cat", "/run/.containerenv"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1")) + }) + It("podman run a container based on a complex local image name", func() { imageName := strings.TrimPrefix(nginx, "quay.io/") session := podmanTest.Podman([]string{"run", imageName, "ls"}) diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go index 8d860cfc3..79ef707a2 100644 --- a/test/e2e/run_userns_test.go +++ b/test/e2e/run_userns_test.go @@ -7,7 +7,7 @@ import ( "os/user" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index 19d82c974..20c43bf4a 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" @@ -322,6 +322,30 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"` Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) }) + It("podman named volume copyup empty directory", func() { + baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/srv"}) + baselineSession.WaitWithDefaultTimeout() + Expect(baselineSession.ExitCode()).To(Equal(0)) + baselineOutput := baselineSession.OutputToString() + + outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/srv", ALPINE, "ls", "/srv"}) + outputSession.WaitWithDefaultTimeout() + Expect(outputSession.ExitCode()).To(Equal(0)) + Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) + }) + + It("podman named volume copyup of /var", func() { + baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", fedoraMinimal, "ls", "/var"}) + baselineSession.WaitWithDefaultTimeout() + Expect(baselineSession.ExitCode()).To(Equal(0)) + baselineOutput := baselineSession.OutputToString() + + outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/var", fedoraMinimal, "ls", "/var"}) + outputSession.WaitWithDefaultTimeout() + Expect(outputSession.ExitCode()).To(Equal(0)) + Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) + }) + It("podman read-only tmpfs conflict with volume", func() { session := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go index 59538448e..2d16cdc18 100644 --- a/test/e2e/run_working_dir_test.go +++ b/test/e2e/run_working_dir_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -47,7 +47,7 @@ var _ = Describe("Podman run", func() { It("podman run a container on an image with a workdir", func() { dockerfile := `FROM alpine -RUN mkdir -p /home/foobar +RUN mkdir -p /home/foobar /etc/foobar; chown bin:bin /etc/foobar WORKDIR /etc/foobar` podmanTest.BuildImage(dockerfile, "test", "false") @@ -56,6 +56,10 @@ WORKDIR /etc/foobar` Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(Equal("/etc/foobar")) + session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."}) + session.WaitWithDefaultTimeout() + Expect(session.LineInOutputContains("bin")).To(BeTrue()) + session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go index 10e16ea23..2eec15c62 100644 --- a/test/e2e/runlabel_test.go +++ b/test/e2e/runlabel_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index a5737c110..5ddd5efc8 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -8,8 +8,8 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 4a11802c3..8c388d0ee 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -9,7 +9,7 @@ import ( "strconv" "text/template" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go index 6dad605c5..fbee18442 100644 --- a/test/e2e/secret_test.go +++ b/test/e2e/secret_test.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index a6f22e007..f527b67f6 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" @@ -95,6 +95,23 @@ var _ = Describe("Podman start", func() { Expect(session.OutputToString()).To(Equal(shortID)) }) + It("podman container start single container by short id", func() { + session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + shortID := cid[0:10] + session = podmanTest.Podman([]string{"container", "start", shortID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal(shortID)) + + session = podmanTest.Podman([]string{"stop", shortID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal(shortID)) + }) + It("podman start single container by name", func() { name := "foobar99" session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"}) diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index 53aa230e9..2218d72b5 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -8,7 +8,7 @@ import ( "strconv" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index 750d38ffb..dd264eb0d 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -5,7 +5,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -149,13 +149,12 @@ var _ = Describe("Podman stop", func() { session := podmanTest.RunTopContainer("test4") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - cid1 := session.OutputToString() session = podmanTest.Podman([]string{"stop", "--time", "1", "test4"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) output := session.OutputToString() - Expect(output).To(ContainSubstring(cid1)) + Expect(output).To(ContainSubstring("test4")) finalCtrs := podmanTest.Podman([]string{"ps", "-q"}) finalCtrs.WaitWithDefaultTimeout() @@ -167,14 +166,13 @@ var _ = Describe("Podman stop", func() { session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - cid1 := session.OutputToString() session = podmanTest.Podman([]string{"stop", "--timeout", "1", "test5"}) // Without timeout container stops in 10 seconds // If not stopped in 5 seconds, then --timeout did not work session.Wait(5) Expect(session.ExitCode()).To(Equal(0)) output := session.OutputToString() - Expect(output).To(ContainSubstring(cid1)) + Expect(output).To(ContainSubstring("test5")) finalCtrs := podmanTest.Podman([]string{"ps", "-q"}) finalCtrs.WaitWithDefaultTimeout() diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go index a23d50f29..4697cf860 100644 --- a/test/e2e/system_connection_test.go +++ b/test/e2e/system_connection_test.go @@ -6,7 +6,7 @@ import ( "os" "github.com/containers/common/pkg/config" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go index 050a01805..9daf3f8f9 100644 --- a/test/e2e/system_df_test.go +++ b/test/e2e/system_df_test.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go index e716ce4f3..fcfcdaf85 100644 --- a/test/e2e/system_reset_test.go +++ b/test/e2e/system_reset_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go index 49ab3b8ed..b132750b0 100644 --- a/test/e2e/systemd_test.go +++ b/test/e2e/systemd_test.go @@ -6,7 +6,7 @@ import ( "strings" "time" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go index 8e8264e9d..83b6d023d 100644 --- a/test/e2e/tag_test.go +++ b/test/e2e/tag_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 6de775983..d605b59f9 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -35,8 +35,8 @@ import ( "strings" "syscall" - "github.com/containers/podman/v2/pkg/rootless" - . "github.com/containers/podman/v2/test/utils" + "github.com/containers/podman/v3/pkg/rootless" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go index c182b88e6..d7105b17a 100644 --- a/test/e2e/top_test.go +++ b/test/e2e/top_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go index 9bdc3af9d..184b99dfb 100644 --- a/test/e2e/tree_test.go +++ b/test/e2e/tree_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go index 19e576490..ae7b987ae 100644 --- a/test/e2e/trust_test.go +++ b/test/e2e/trust_test.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go index 182a65775..515b3a42e 100644 --- a/test/e2e/unshare_test.go +++ b/test/e2e/unshare_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go index 4d4f60f0c..d0d271715 100644 --- a/test/e2e/untag_test.go +++ b/test/e2e/untag_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index 903748b58..75986e671 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -4,8 +4,8 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" - "github.com/containers/podman/v2/version" + . "github.com/containers/podman/v3/test/utils" + "github.com/containers/podman/v3/version" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go index 544532ee0..ab65146eb 100644 --- a/test/e2e/volume_create_test.go +++ b/test/e2e/volume_create_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/volume_exists_test.go b/test/e2e/volume_exists_test.go index 6073c6d90..edbeb2c69 100644 --- a/test/e2e/volume_exists_test.go +++ b/test/e2e/volume_exists_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go index 7ff1d63b4..05aaf1025 100644 --- a/test/e2e/volume_inspect_test.go +++ b/test/e2e/volume_inspect_test.go @@ -4,7 +4,7 @@ import ( "os" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go index 5c466124d..cb5ecbcc3 100644 --- a/test/e2e/volume_ls_test.go +++ b/test/e2e/volume_ls_test.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go index 16edab27c..183050e8c 100644 --- a/test/e2e/volume_plugin_test.go +++ b/test/e2e/volume_plugin_test.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go index a910c47a7..1d4e64ec7 100644 --- a/test/e2e/volume_prune_test.go +++ b/test/e2e/volume_prune_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go index cdced1f13..883a503c4 100644 --- a/test/e2e/volume_rm_test.go +++ b/test/e2e/volume_rm_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index 4f1e74977..71df28ca8 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -3,7 +3,7 @@ package integration import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py index 5c2a5fef2..337cacd5c 100644 --- a/test/python/docker/test_containers.py +++ b/test/python/docker/test_containers.py @@ -86,6 +86,13 @@ class TestContainers(unittest.TestCase): containers = self.client.containers.list(all=True) self.assertEqual(len(containers), 2) + def test_start_container_with_random_port_bind(self): + container = self.client.containers.create(image=constant.ALPINE, + name="containerWithRandomBind", + ports={'1234/tcp': None}) + containers = self.client.containers.list(all=True) + self.assertTrue(container in containers) + def test_stop_container(self): top = self.client.containers.get(TestContainers.topContainerId) self.assertEqual(top.status, "running") diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 3749dcac5..93449ece9 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -662,4 +662,10 @@ json-file | f run_podman rm $cname } +@test "podman run - do not set empty HOME" { + # Regression test for #9378. + run_podman run --rm --user 100 $IMAGE printenv + is "$output" ".*HOME=/.*" +} + # vim: filetype=sh diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats index d3cf1c274..0fcc437d4 100644 --- a/test/system/065-cp.bats +++ b/test/system/065-cp.bats @@ -18,6 +18,8 @@ load helpers echo "${randomcontent[0]}" > $srcdir/hostfile0 echo "${randomcontent[1]}" > $srcdir/hostfile1 echo "${randomcontent[2]}" > $srcdir/hostfile2 + mkdir -p $srcdir/subdir + echo "${randomcontent[2]}" > $srcdir/subdir/dotfile. run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity run_podman exec cpcontainer mkdir /srv/subdir @@ -50,6 +52,11 @@ load helpers is "$output" "${randomcontent[$id]}" "$description (cp -> ctr:$dest)" done < <(parse_table "$tests") + # Dots are special for dirs not files. + run_podman cp $srcdir/subdir/dotfile. cpcontainer:/tmp + run_podman exec cpcontainer cat /tmp/dotfile. + is "$output" "${randomcontent[2]}" "$description (cp -> ctr:$dest)" + # Host path does not exist. run_podman 125 cp $srcdir/IdoNotExist cpcontainer:/tmp is "$output" 'Error: ".*/IdoNotExist" could not be found on the host' \ @@ -76,12 +83,14 @@ load helpers ) run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity run_podman exec cpcontainer sh -c "echo ${randomcontent[0]} > /tmp/containerfile" + run_podman exec cpcontainer sh -c "echo ${randomcontent[0]} > /tmp/dotfile." run_podman exec cpcontainer sh -c "echo ${randomcontent[1]} > /srv/containerfile1" run_podman exec cpcontainer sh -c "mkdir /srv/subdir; echo ${randomcontent[2]} > /srv/subdir/containerfile2" # format is: <id> | <source arg to cp> | <destination arg (appended to $srcdir) to cp> | <full dest path (appended to $srcdir)> | <test name> tests=" 0 | /tmp/containerfile | | /containerfile | copy to srcdir/ +0 | /tmp/dotfile. | | /dotfile. | copy to srcdir/ 0 | /tmp/containerfile | / | /containerfile | copy to srcdir/ 0 | /tmp/containerfile | /. | /containerfile | copy to srcdir/. 0 | /tmp/containerfile | /newfile | /newfile | copy to srcdir/newfile @@ -117,12 +126,18 @@ load helpers echo "${randomcontent[0]}" > $srcdir/hostfile0 echo "${randomcontent[1]}" > $srcdir/hostfile1 + # "." and "dir/." will copy the contents, so make sure that a dir ending + # with dot is treated correctly. + mkdir -p $srcdir. + cp $srcdir/* $srcdir./ + run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity run_podman exec cpcontainer mkdir /srv/subdir # format is: <source arg to cp (appended to srcdir)> | <destination arg to cp> | <full dest path> | <test name> tests=" | / | /dir-test | copy to root + . | / | /dir-test. | copy dotdir to root / | /tmp | /tmp/dir-test | copy to tmp /. | /usr/ | /usr/ | copy contents of dir to usr/ | . | /srv/dir-test | copy to workdir (rel path) @@ -153,6 +168,9 @@ load helpers run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity run_podman exec cpcontainer sh -c 'mkdir /srv/subdir; echo "This first file is on the container" > /srv/subdir/containerfile1' run_podman exec cpcontainer sh -c 'echo "This second file is on the container as well" > /srv/subdir/containerfile2' + # "." and "dir/." will copy the contents, so make sure that a dir ending + # with dot is treated correctly. + run_podman exec cpcontainer sh -c 'mkdir /tmp/subdir.; cp /srv/subdir/* /tmp/subdir./' run_podman cp cpcontainer:/srv $srcdir run cat $srcdir/srv/subdir/containerfile1 @@ -174,6 +192,14 @@ load helpers is "$output" "This first file is on the container" run cat $srcdir/containerfile2 is "$output" "This second file is on the container as well" + rm -rf $srcdir/subdir + + run_podman cp cpcontainer:/tmp/subdir. $srcdir + run cat $srcdir/subdir./containerfile1 + is "$output" "This first file is on the container" + run cat $srcdir/subdir./containerfile2 + is "$output" "This second file is on the container as well" + rm -rf $srcdir/subdir. run_podman rm -f cpcontainer } diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 3ae95b5f5..89f3f5c64 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -46,6 +46,31 @@ EOF is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime" } +@test "podman build - set runtime" { + skip_if_remote "--runtime flag not supported for remote" + # Test on the CLI and via containers.conf + + tmpdir=$PODMAN_TMPDIR/build-test + run mkdir -p $tmpdir + containerfile=$tmpdir/Containerfile + cat >$containerfile <<EOF +FROM $IMAGE +RUN echo $rand_content +EOF + + run_podman 125 --runtime=idonotexist build -t build_test $tmpdir + is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via CLI" + + containersconf=$tmpdir/containers.conf + cat >$containersconf <<EOF +[engine] +runtime="idonotexist" +EOF + + CONTAINERS_CONF="$containersconf" run_podman 125 build -t build_test $tmpdir + is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via containers.conf" +} + # Regression from v1.5.0. This test passes fine in v1.5.0, fails in 1.6 @test "podman build - cache (#3920)" { # Make an empty test directory, with a subdirectory used for tar diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go index 2f9e6f2c7..003d490ce 100644 --- a/test/utils/common_function_test.go +++ b/test/utils/common_function_test.go @@ -8,7 +8,7 @@ import ( "reflect" "strings" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" diff --git a/test/utils/podmansession_test.go b/test/utils/podmansession_test.go index 763cb4f26..d85f27bbb 100644 --- a/test/utils/podmansession_test.go +++ b/test/utils/podmansession_test.go @@ -1,7 +1,7 @@ package utils_test import ( - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/utils/podmantest_test.go b/test/utils/podmantest_test.go index 538d55d8d..9bd1c4a66 100644 --- a/test/utils/podmantest_test.go +++ b/test/utils/podmantest_test.go @@ -3,7 +3,7 @@ package utils_test import ( "os" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) diff --git a/test/utils/utils.go b/test/utils/utils.go index 6790f31cd..80af7fb7c 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -482,3 +482,13 @@ func RandomString(n int) string { } return string(b) } + +//SkipIfInContainer skips a test if the test is run inside a container +func SkipIfInContainer(reason string) { + if len(reason) < 5 { + panic("SkipIfInContainer must specify a reason to skip") + } + if os.Getenv("TEST_ENVIRON") == "container" { + Skip("[container]: " + reason) + } +} diff --git a/test/utils/utils_suite_test.go b/test/utils/utils_suite_test.go index 01549f06e..d5f9cbce4 100644 --- a/test/utils/utils_suite_test.go +++ b/test/utils/utils_suite_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - . "github.com/containers/podman/v2/test/utils" + . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" |