diff options
Diffstat (limited to 'test')
27 files changed, 312 insertions, 70 deletions
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at index 2cfca9d08..33f4ea37f 100644 --- a/test/apiv2/30-volumes.at +++ b/test/apiv2/30-volumes.at @@ -49,8 +49,8 @@ t GET libpod/volumes/json 200 \ t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22foo1%22%5D%7D 200 length=1 .[0].Name=foo1 # -G --data-urlencode 'filters={"name":["foo1","foo2"]}' t GET libpod/volumes/json?filters=%7B%22name%22%3A%20%5B%22foo1%22%2C%20%22foo2%22%5D%7D 200 length=2 .[0].Name=foo1 .[1].Name=foo2 -# -G --data-urlencode 'filters={"name":["notexist"]}' -t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22notexists%22%5D%7D 200 length=0 +# -G --data-urlencode 'filters={"name":["nonexistent"]}' +t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22nonexistent%22%5D%7D 200 length=0 # -G --data-urlencode 'filters={"label":["testlabel"]}' t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D 200 length=2 # -G --data-urlencode 'filters={"label":["testlabel=testonly"]}' @@ -63,7 +63,7 @@ t GET libpod/volumes/foo1/json 200 \ .Name=foo1 \ .Mountpoint=$volumepath/foo1/_data \ .CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* -t GET libpod/volumes/notexist/json 404 \ +t GET libpod/volumes/nonexistent/json 404 \ .cause="no such volume" \ .message~.* \ .response=404 diff --git a/test/apiv2/45-system.at b/test/apiv2/45-system.at new file mode 100644 index 000000000..7d14fd4b3 --- /dev/null +++ b/test/apiv2/45-system.at @@ -0,0 +1,67 @@ +# -*- sh -*- +# +# system related tests +# + +## ensure system is clean +t POST 'libpod/system/prune?volumes=true&all=true' params='' 200 + +## podman system df +t GET system/df 200 '{"LayersSize":0,"Images":[],"Containers":[],"Volumes":[],"BuildCache":[],"BuilderSize":0}' +t GET libpod/system/df 200 '{"Images":[],"Containers":[],"Volumes":[]}' + +# Create volume. We expect df to report this volume next invocation of system/df +t GET libpod/info 200 +volumepath=$(jq -r ".store.volumePath" <<<"$output") +t POST libpod/volumes/create name=foo1 201 \ + .Name=foo1 \ + .Driver=local \ + .Mountpoint=$volumepath/foo1/_data \ + .CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \ + .Labels={} \ + .Options=null + +t GET system/df 200 '.Volumes[0].Name=foo1' + +t GET libpod/system/df 200 '.Volumes[0].VolumeName=foo1' + +# Create two more volumes to test pruneing +t POST libpod/volumes/create \ + '"Name":"foo2","Label":{"testlabel1":""},"Options":{"type":"tmpfs","o":"nodev,noexec"}}' 201 \ + .Name=foo2 \ + .Driver=local \ + .Mountpoint=$volumepath/foo2/_data \ + .CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \ + .Labels.testlabel1="" \ + .Options.o=nodev,noexec + +t POST libpod/volumes/create \ + '"Name":"foo3","Label":{"testlabel1":"testonly"},"Options":{"type":"tmpfs","o":"nodev,noexec"}}' 201 \ + .Name=foo3 \ + .Driver=local \ + .Mountpoint=$volumepath/foo3/_data \ + .CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \ + .Labels.testlabel1=testonly \ + .Options.o=nodev,noexec + +t GET system/df 200 '.Volumes | length=3' +t GET libpod/system/df 200 '.Volumes | length=3' + +# Prune volumes + +# -G --data-urlencode 'volumes=true&filters={"label":["testlabel1=idontmatch"]}' +t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1=idontmatch%22%5D%7D' params='' 200 + +# nothing should have been pruned +t GET system/df 200 '.Volumes | length=3' +t GET libpod/system/df 200 '.Volumes | length=3' + +# -G --data-urlencode 'volumes=true&filters={"label":["testlabel1=testonly"]}' +# only foo3 should be pruned because of filter +t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D' params='' 200 .VolumePruneReport[0].Id=foo3 +# only foo2 should be pruned because of filter +t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1%22%5D%7D' params='' 200 .VolumePruneReport[0].Id=foo2 +# foo1, the last remaining volume should be pruned without any filters applied +t POST 'libpod/system/prune?volumes=true' params='' 200 .VolumePruneReport[0].Id=foo1 + +# TODO add other system prune tests for pods / images diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index d7bbdc633..a076ada6b 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -62,7 +62,7 @@ type PodmanTestIntegration struct { var LockTmpDir string -// PodmanSessionIntegration sturct for command line session +// PodmanSessionIntegration struct for command line session type PodmanSessionIntegration struct { *PodmanSession } @@ -121,7 +121,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { } } - // Pull cirros but dont put it into the cache + // Pull cirros but don't put it into the cache pullImages := []string{cirros, fedoraToolbox} pullImages = append(pullImages, CACHE_IMAGES...) for _, image := range pullImages { diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index 6fe26c444..f81323847 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -60,7 +60,7 @@ var _ = Describe("Podman cp", func() { // Copy TO the container. - // Cannot copy to a non-existent path (note the trailing "/"). + // Cannot copy to a nonexistent path (note the trailing "/"). session = podmanTest.Podman([]string{"cp", srcFile.Name(), name + ":foo/"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index aaf089d97..a4931ff2d 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -233,7 +233,7 @@ var _ = Describe("Podman create", func() { Expect(err).To(BeNil()) defer os.RemoveAll(tmpDir) - podName := "rudoplh" + podName := "rudolph" ctrName := "prancer" podIDFile := tmpDir + "pod-id-file" @@ -337,8 +337,8 @@ var _ = Describe("Podman create", func() { Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) }) - It("podman create --authfile with nonexist authfile", func() { - session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexist", "--name=foo", ALPINE}) + It("podman create --authfile with nonexistent authfile", func() { + session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexistent", "--name=foo", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).To(Not(Equal(0))) }) @@ -655,7 +655,7 @@ var _ = Describe("Podman create", func() { session = podmanTest.Podman([]string{"create", "--platform=linux/arm64", "--override-os", "windows", ALPINE}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) - expectedError = "--platform option can not be specified with --overide-arch or --override-os" + expectedError = "--platform option can not be specified with --override-arch or --override-os" Expect(session.ErrorToString()).To(ContainSubstring(expectedError)) session = podmanTest.Podman([]string{"create", "-q", "--platform=linux/arm64", ALPINE}) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 281b2c313..2dab4858e 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -146,17 +146,17 @@ var _ = Describe("Podman images", func() { Expect(result).Should(Exit(0)) Expect(len(result.OutputToStringArray())).To(Equal(8)) - retapline := podmanTest.Podman([]string{"images", "-f", "reference=a*pine"}) - retapline.WaitWithDefaultTimeout() - Expect(retapline).Should(Exit(0)) - Expect(len(retapline.OutputToStringArray())).To(Equal(6)) - Expect(retapline.LineInOutputContains("alpine")).To(BeTrue()) - - retapline = podmanTest.Podman([]string{"images", "-f", "reference=alpine"}) - retapline.WaitWithDefaultTimeout() - Expect(retapline).Should(Exit(0)) - Expect(len(retapline.OutputToStringArray())).To(Equal(6)) - Expect(retapline.LineInOutputContains("alpine")).To(BeTrue()) + retalpine := podmanTest.Podman([]string{"images", "-f", "reference=a*pine"}) + retalpine.WaitWithDefaultTimeout() + Expect(retalpine).Should(Exit(0)) + Expect(len(retalpine.OutputToStringArray())).To(Equal(6)) + Expect(retalpine.LineInOutputContains("alpine")).To(BeTrue()) + + retalpine = podmanTest.Podman([]string{"images", "-f", "reference=alpine"}) + retalpine.WaitWithDefaultTimeout() + Expect(retalpine).Should(Exit(0)) + Expect(len(retalpine.OutputToStringArray())).To(Equal(6)) + Expect(retalpine.LineInOutputContains("alpine")).To(BeTrue()) retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"}) retnone.WaitWithDefaultTimeout() diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index 5de77f158..a2e88ecd2 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -66,7 +66,7 @@ var _ = Describe("Podman login and logout", func() { registriesConfWithSearch = []byte(fmt.Sprintf("[registries.search]\nregistries = ['%s']", server)) - testImg = strings.Join([]string{server, "test-apline"}, "/") + testImg = strings.Join([]string{server, "test-alpine"}, "/") certDirPath = filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", server) os.MkdirAll(certDirPath, os.ModePerm) @@ -155,8 +155,8 @@ var _ = Describe("Podman login and logout", func() { json.Unmarshal(authInfo, &info) fmt.Println(info) - // push should fail with nonexist authfile - session = podmanTest.Podman([]string{"push", "--authfile", "/tmp/nonexist", ALPINE, testImg}) + // push should fail with nonexistent authfile + session = podmanTest.Podman([]string{"push", "--authfile", "/tmp/nonexistent", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Not(Equal(0))) @@ -168,8 +168,8 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - // logout should fail with nonexist authfile - session = podmanTest.Podman([]string{"logout", "--authfile", "/tmp/nonexist", server}) + // logout should fail with nonexistent authfile + session = podmanTest.Podman([]string{"logout", "--authfile", "/tmp/nonexistent", server}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Not(Equal(0))) diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go index 1e4152709..c410a2507 100644 --- a/test/e2e/mount_rootless_test.go +++ b/test/e2e/mount_rootless_test.go @@ -16,7 +16,7 @@ var _ = Describe("Podman mount", func() { ) BeforeEach(func() { - SkipIfNotRootless("This function is not enabled for rootfull podman") + SkipIfNotRootless("This function is not enabled for rootful podman") SkipIfRemote("Podman mount not supported for remote connections") tempdir, err = CreateTempDirInTempDir() if err != nil { diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go index 7cdad9bf2..dd94bd7ca 100644 --- a/test/e2e/network_connect_disconnect_test.go +++ b/test/e2e/network_connect_disconnect_test.go @@ -33,7 +33,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("bad network name in disconnect should result in error", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") dis := podmanTest.Podman([]string{"network", "disconnect", "foobar", "test"}) dis.WaitWithDefaultTimeout() Expect(dis.ExitCode()).ToNot(BeZero()) @@ -41,7 +41,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("bad container name in network disconnect should result in error", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -55,7 +55,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman network disconnect", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -80,7 +80,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("bad network name in connect should result in error", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"}) dis.WaitWithDefaultTimeout() Expect(dis.ExitCode()).ToNot(BeZero()) @@ -88,7 +88,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("bad container name in network connect should result in error", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -102,7 +102,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman connect on a container that already is connected to the network should error", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -120,7 +120,7 @@ var _ = Describe("Podman network connect and disconnect", func() { It("podman network connect", func() { SkipIfRemote("This requires a pending PR to be merged before it will work") - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -152,7 +152,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman network connect when not running", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -181,7 +181,7 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman network disconnect when not running", func() { - SkipIfRootless("network connect and disconnect are only rootfull") + SkipIfRootless("network connect and disconnect are only rootful") netName1 := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName1}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 3a2387559..ff3189038 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -16,7 +16,7 @@ import ( ) var unknownKindYaml = ` -apiVerson: v1 +apiVersion: v1 kind: UnknownKind metadata: labels: @@ -793,11 +793,11 @@ var _ = Describe("Podman play kube", func() { }) - It("podman play kube fail with nonexist authfile", func() { + It("podman play kube fail with nonexistent authfile", func() { err := generateKubeYaml("pod", getPod(), kubeYaml) Expect(err).To(BeNil()) - kube := podmanTest.Podman([]string{"play", "kube", "--authfile", "/tmp/nonexist", kubeYaml}) + kube := podmanTest.Podman([]string{"play", "kube", "--authfile", "/tmp/nonexistent", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube.ExitCode()).To(Not(Equal(0))) @@ -820,8 +820,28 @@ var _ = Describe("Podman play kube", func() { Expect(inspect.OutputToString()).To(ContainSubstring(correctCmd)) }) + // If you do not supply command or args for a Container, the defaults defined in the Docker image are used. + It("podman play kube test correct args and cmd when not specified", func() { + pod := getPod(withCtr(getCtr(withImage(registry), withCmd(nil), withArg(nil)))) + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + + // this image's ENTRYPOINT is `/entrypoint.sh` and it's COMMAND is `/etc/docker/registry/config.yml` + Expect(inspect.OutputToString()).To(ContainSubstring(`[/entrypoint.sh /etc/docker/registry/config.yml]`)) + }) + + // If you supply a command but no args for a Container, only the supplied command is used. + // The default EntryPoint and the default Cmd defined in the Docker image are ignored. It("podman play kube test correct command with only set command in yaml file", func() { - pod := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg(nil)))) + pod := getPod(withCtr(getCtr(withImage(registry), withCmd([]string{"echo", "hello"}), withArg(nil)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(BeNil()) @@ -837,8 +857,9 @@ var _ = Describe("Podman play kube", func() { Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello]`)) }) + // If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied. It("podman play kube test correct command with only set args in yaml file", func() { - pod := getPod(withCtr(getCtr(withImage(redis), withCmd(nil), withArg([]string{"echo", "hello"})))) + pod := getPod(withCtr(getCtr(withImage(registry), withCmd(nil), withArg([]string{"echo", "hello"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(BeNil()) @@ -849,9 +870,27 @@ var _ = Describe("Podman play kube", func() { inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect.ExitCode()).To(Equal(0)) - // this image's ENTRYPOINT is called `docker-entrypoint.sh` - // so result should be `docker-entrypoint.sh + withArg(...)` - Expect(inspect.OutputToString()).To(ContainSubstring(`[docker-entrypoint.sh echo hello]`)) + // this image's ENTRYPOINT is `/entrypoint.sh` + // so result should be `/entrypoint.sh + withArg(...)` + Expect(inspect.OutputToString()).To(ContainSubstring(`[/entrypoint.sh echo hello]`)) + }) + + // If you supply a command and args, + // the default Entrypoint and the default Cmd defined in the Docker image are ignored. + // Your command is run with your args. + It("podman play kube test correct command with both set args and cmd in yaml file", func() { + pod := getPod(withCtr(getCtr(withImage(registry), withCmd([]string{"echo"}), withArg([]string{"hello"})))) + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello]`)) }) It("podman play kube test correct output", func() { @@ -1240,7 +1279,7 @@ spec: inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[0]), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect.ExitCode()).To(Equal(0)) - // yaml's command shuold override the image's Entrypoint + // yaml's command should override the image's Entrypoint correctCmd := "[" + strings.Join(defaultCtrCmd, " ") + " " + strings.Join(defaultCtrArg, " ") Expect(inspect.OutputToString()).To(ContainSubstring(correctCmd)) }) @@ -1285,7 +1324,7 @@ spec: Expect(inspect.OutputToString()).To(Equal("5000/tcp -> 127.0.0.100:5000")) }) - It("podman play kube test with non-existent empty HostPath type volume", func() { + It("podman play kube test with nonexistent empty HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume(`""`, hostPathLocation))) @@ -1312,7 +1351,7 @@ spec: Expect(kube.ExitCode()).To(Equal(0)) }) - It("podman play kube test with non-existent File HostPath type volume", func() { + It("podman play kube test with nonexistent File HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume("File", hostPathLocation))) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index c02ed5a50..3bc1012df 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -349,4 +349,64 @@ var _ = Describe("Podman prune", func() { // all images are unused, so they all should be deleted! Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES))) }) + + It("podman system prune --volumes --filter", func() { + session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv1", "myvol2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv2", "myvol3"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1", "myvol4"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"create", "-v", "myvol5:/myvol5", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"create", "-v", "myvol6:/myvol6", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(7)) + + session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=label1=value1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(6)) + + session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1=slv1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(5)) + + session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + + podmanTest.Cleanup() + }) }) diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 05571157c..0c5d817ba 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -673,4 +673,55 @@ var _ = Describe("Podman ps", func() { Expect(session.LineInOutputContains("test3")).To(BeTrue()) Expect(session.LineInOutputContains("test4")).To(BeTrue()) }) + It("podman ps filter pod", func() { + pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"}) + pod1.WaitWithDefaultTimeout() + Expect(pod1.ExitCode()).To(BeZero()) + con1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod1", ALPINE, "top"}) + con1.WaitWithDefaultTimeout() + Expect(con1.ExitCode()).To(BeZero()) + + pod2 := podmanTest.Podman([]string{"pod", "create", "--name", "pod2"}) + pod2.WaitWithDefaultTimeout() + Expect(pod2.ExitCode()).To(BeZero()) + con2 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod2", ALPINE, "top"}) + con2.WaitWithDefaultTimeout() + Expect(con2.ExitCode()).To(BeZero()) + + // bogus pod name or id should not result in error + session := podmanTest.Podman([]string{"ps", "--filter", "pod=1234"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + + // filter by pod name + session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray())) + + // filter by full pod id + session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray())) + + // filter by partial pod id + session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()[0:12]}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray())) + + // filter by multiple pods is inclusive + session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1", "--filter", "pod=pod2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + Expect(len(session.OutputToStringArray())).To(Equal(4)) + Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray())) + Expect(StringInSlice(pod2.OutputToString(), session.OutputToStringArray())) + + }) + }) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 446e2bd38..7099a2904 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -393,8 +393,8 @@ var _ = Describe("Podman pull", func() { Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4)) }) - It("podman pull from docker with nonexist --authfile", func() { - session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexist", ALPINE}) + It("podman pull from docker with nonexistent --authfile", func() { + session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexistent", ALPINE}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Not(Equal(0))) }) @@ -506,7 +506,7 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"pull", "--platform=linux/arm64", "--override-os", "windows", ALPINE}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) - expectedError = "--platform option can not be specified with --overide-arch or --override-os" + expectedError = "--platform option can not be specified with --override-arch or --override-os" Expect(session.ErrorToString()).To(ContainSubstring(expectedError)) session = podmanTest.Podman([]string{"pull", "-q", "--platform=linux/arm64", ALPINE}) diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index c8d77b7c6..1f40e4928 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -113,7 +113,7 @@ var _ = Describe("Podman rmi", func() { }) It("podman rmi image that is a parent of another image", func() { - Skip("I need help with this one. i dont understand what is going on") + Skip("I need help with this one. i don't understand what is going on") podmanTest.AddImageToRWStore(cirros) session := podmanTest.Podman([]string{"run", "--name", "c_test", cirros, "true"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index c32446663..4888a676b 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1230,8 +1230,8 @@ USER mail` Expect(session).To(ExitWithError()) }) - It("podman run should fail with nonexist authfile", func() { - session := podmanTest.Podman([]string{"run", "--authfile", "/tmp/nonexist", ALPINE, "ls"}) + It("podman run should fail with nonexistent authfile", func() { + session := podmanTest.Podman([]string{"run", "--authfile", "/tmp/nonexistent", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Not(Equal(0))) }) diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go index 7c0b8bc9b..10e16ea23 100644 --- a/test/e2e/runlabel_test.go +++ b/test/e2e/runlabel_test.go @@ -114,12 +114,12 @@ var _ = Describe("podman container runlabel", func() { Expect(result.ExitCode()).To(Equal(0)) }) - It("runlabel should fail with nonexist authfile", func() { + It("runlabel should fail with nonexistent authfile", func() { image := "podman-runlabel-test:podman" podmanTest.BuildImage(PodmanDockerfile, image, "false") - // runlabel should fail with nonexist authfile - result := podmanTest.Podman([]string{"container", "runlabel", "--authfile", "/tmp/nonexist", "RUN", image}) + // runlabel should fail with nonexistent authfile + result := podmanTest.Podman([]string{"container", "runlabel", "--authfile", "/tmp/nonexistent", "RUN", image}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Not(Equal(0))) diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 5c3c69fd4..f809c5afe 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -430,9 +430,9 @@ registries = ['{{.Host}}:{{.Port}}']` resetRegistriesConfigEnv() }) - // search should fail with nonexist authfile - It("podman search fail with nonexist --authfile", func() { - search := podmanTest.Podman([]string{"search", "--authfile", "/tmp/nonexist", ALPINE}) + // search should fail with nonexistent authfile + It("podman search fail with nonexistent --authfile", func() { + search := podmanTest.Podman([]string{"search", "--authfile", "/tmp/nonexistent", ALPINE}) search.WaitWithDefaultTimeout() Expect(search.ExitCode()).To(Not(Equal(0))) }) diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index ab117a2a0..53aa230e9 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -140,7 +140,7 @@ var _ = Describe("Podman stats", func() { // Regression test for #8265 It("podman stats with custom memory limits", func() { - // Run thre containers. One with a memory limit. Make sure + // Run three containers. One with a memory limit. Make sure // that the limits are different and the limited one has a // lower limit. ctrNoLimit0 := "no-limit-0" diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go index 2a7feaacb..9bdc3af9d 100644 --- a/test/e2e/tree_test.go +++ b/test/e2e/tree_test.go @@ -35,7 +35,7 @@ var _ = Describe("Podman image tree", func() { It("podman image tree", func() { SkipIfRemote("Does not work on remote client") - Skip("dont understand why this fails") + Skip("don't understand why this fails") podmanTest.AddImageToRWStore(cirros) dockerfile := `FROM quay.io/libpod/cirros:latest RUN mkdir hello diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go index 8c44e57e4..544532ee0 100644 --- a/test/e2e/volume_create_test.go +++ b/test/e2e/volume_create_test.go @@ -82,5 +82,13 @@ var _ = Describe("Podman volume create", func() { inspectGID.WaitWithDefaultTimeout() Expect(inspectGID.ExitCode()).To(Equal(0)) Expect(inspectGID.OutputToString()).To(Equal(gid)) + + // options should containt `uid=3000,gid=4000:3000:4000` + optionFormat := `{{ .Options.o }}:{{ .Options.UID }}:{{ .Options.GID }}` + optionStrFormatExpect := fmt.Sprintf(`uid=%s,gid=%s:%s:%s`, uid, gid, uid, gid) + inspectOpts := podmanTest.Podman([]string{"volume", "inspect", "--format", optionFormat, volName}) + inspectOpts.WaitWithDefaultTimeout() + Expect(inspectOpts.ExitCode()).To(Equal(0)) + Expect(inspectOpts.OutputToString()).To(Equal(optionStrFormatExpect)) }) }) diff --git a/test/framework/framework.go b/test/framework/framework.go index 52401faf8..57c6bda2a 100644 --- a/test/framework/framework.go +++ b/test/framework/framework.go @@ -7,7 +7,7 @@ import ( "github.com/onsi/gomega" ) -// TestFramework is used to support commonnly used test features +// TestFramework is used to support commonly used test features type TestFramework struct { setup func(*TestFramework) error teardown func(*TestFramework) error diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py index 20d8417c3..5a9f761a6 100644 --- a/test/python/docker/test_containers.py +++ b/test/python/docker/test_containers.py @@ -143,7 +143,7 @@ class TestContainers(unittest.TestCase): top = self.client.containers.get(TestContainers.topContainerId) top.stop() - # Pause exited container should trow error + # Pause exited container should throw error with self.assertRaises(errors.APIError) as error: top.pause() self.assertEqual(error.exception.response.status_code, 500) diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats index 73b07ea45..d3cf1c274 100644 --- a/test/system/065-cp.bats +++ b/test/system/065-cp.bats @@ -499,7 +499,7 @@ load helpers tar xvf $srcdir/stdout.tar -C $srcdir run cat $srcdir/file.txt is "$output" "$rand_content" - run 1 ls $srcfir/empty.txt + run 1 ls $srcdir/empty.txt rm -f $srcdir/* # Copy directory. diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 8e9a2d613..0e83a184b 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -345,7 +345,7 @@ EOF # all commands after 'podman build' would silently be ignored. # In the test below, prior to #8092, the 'sed' would not get # any input, and we would never see $random3 in the output. - # And, we use 'sed' to massage $random3 juuuuust on the remote + # And, we use 'sed' to massage $random3 just on the remote # chance that podman itself could pass stdin through. results=$(echo $random3 | ( echo $random1 @@ -424,6 +424,23 @@ EOF run_podman rmi -a --force } +@test "podman build --logfile test" { + tmpdir=$PODMAN_TMPDIR/build-test + mkdir -p $tmpdir + tmpbuilddir=$tmpdir/build + mkdir -p $tmpbuilddir + dockerfile=$tmpbuilddir/Dockerfile + cat >$dockerfile <<EOF +FROM $IMAGE +EOF + + run_podman build -t build_test --format=docker --logfile=$tmpdir/logfile $tmpbuilddir + run cat $tmpdir/logfile + is "$output" ".*STEP 2: COMMIT" "COMMIT seen in log" + + run_podman rmi -f build_test +} + function teardown() { # A timeout or other error in 'build' can leave behind stale images # that podman can't even see and which will cascade into subsequent diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats index e52db9af0..8cac2c9aa 100644 --- a/test/system/600-completion.bats +++ b/test/system/600-completion.bats @@ -158,7 +158,7 @@ function check_shell_completion() { ;;& *PATH* | *CONTEXT* | *KUBEFILE* | *COMMAND* | *ARG...* | *URI*) - # default shell completion should be done for everthing which accepts a path + # default shell completion should be done for everything which accepts a path run_completion "$@" $cmd "${extra_args[@]}" "" # cp is a special case it returns ShellCompDirectiveNoSpace @@ -197,7 +197,7 @@ function check_shell_completion() { run_completion "$@" $cmd "${extra_args[@]}" "" _check_completion_end NoFileComp if [ ${#lines[@]} -gt 2 ]; then - # checking for line count is not enough since we may inlcude additional debug output + # checking for line count is not enough since we may include additional debug output # lines starting with [Debug] are allowed i=0 length=$(( ${#lines[@]} - 2 )) diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go index 0bbc31d5b..2f9e6f2c7 100644 --- a/test/utils/common_function_test.go +++ b/test/utils/common_function_test.go @@ -64,7 +64,7 @@ var _ = Describe("Common functions test", func() { Expect(host.Version).To(Equal(strings.Trim(ver, "\""))) } }, - Entry("Configure file is not exist.", "/tmp/notexist", "", "", true), + Entry("Configure file is not exist.", "/tmp/nonexistent", "", "", true), Entry("Item value with and without \"", "/tmp/os-release.test", "fedora", "\"28\"", false), Entry("Item empty with and without \"", "/tmp/os-release.test", "", "\"\"", false), ) @@ -142,7 +142,7 @@ var _ = Describe("Common functions test", func() { Expect(Containerized()).To(Equal(expect)) }, Entry("Set container in env", "", true, false, true), - Entry("Can not read from file", "/tmp/notexist", false, false, false), + Entry("Can not read from file", "/tmp/nonexistent", false, false, false), Entry("Docker in cgroup file", "/tmp/cgroup.test", false, true, true), Entry("Docker not in cgroup file", "/tmp/cgroup.test", false, true, false), ) diff --git a/test/utils/utils.go b/test/utils/utils.go index 027e96427..f21584537 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -432,7 +432,7 @@ func IsKernelNewerThan(version string) (bool, error) { } -// IsCommandAvaible check if command exist +// IsCommandAvailable check if command exist func IsCommandAvailable(command string) bool { check := exec.Command("bash", "-c", strings.Join([]string{"command -v", command}, " ")) err := check.Run() |