diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/attach_test.go | 4 | ||||
-rw-r--r-- | test/e2e/create_test.go | 18 | ||||
-rw-r--r-- | test/e2e/generate_systemd_test.go | 4 | ||||
-rw-r--r-- | test/e2e/init_test.go | 10 | ||||
-rw-r--r-- | test/e2e/logs_test.go | 2 | ||||
-rw-r--r-- | test/e2e/pod_rm_test.go | 2 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 2 | ||||
-rw-r--r-- | test/e2e/restart_test.go | 2 | ||||
-rw-r--r-- | test/e2e/run_networking_test.go | 12 | ||||
-rw-r--r-- | test/e2e/run_security_labels.go | 4 | ||||
-rw-r--r-- | test/e2e/run_volume_test.go | 2 | ||||
-rw-r--r-- | test/e2e/save_test.go | 69 | ||||
-rw-r--r-- | test/e2e/sign/key.gpg | 30 | ||||
-rw-r--r-- | test/e2e/sign/policy.json | 18 | ||||
-rw-r--r-- | test/e2e/start_test.go | 14 | ||||
-rw-r--r-- | test/e2e/stop_test.go | 2 | ||||
-rw-r--r-- | test/e2e/systemd_test.go | 2 | ||||
-rw-r--r-- | test/e2e/wait_test.go | 45 | ||||
-rw-r--r-- | test/system/015-help.bats | 36 | ||||
-rw-r--r-- | test/system/030-run.bats | 19 | ||||
-rw-r--r-- | test/system/090-events.bats | 14 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 2 |
22 files changed, 264 insertions, 49 deletions
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go index 8065f6298..0c27e05c7 100644 --- a/test/e2e/attach_test.go +++ b/test/e2e/attach_test.go @@ -40,7 +40,7 @@ var _ = Describe("Podman attach", func() { }) It("podman attach to non-running container", func() { - session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", "-i", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", "test1", "-i", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -50,7 +50,7 @@ var _ = Describe("Podman attach", func() { }) It("podman container attach to non-running container", func() { - session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-d", "-i", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-i", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 96a234446..6b0f7a7af 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -626,4 +626,22 @@ var _ = Describe("Podman create", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeZero()) }) + + It("podman create -d should fail, can not detach create containers", func() { + session := podmanTest.Podman([]string{"create", "-d", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + Expect(session.ErrorToString()).To(ContainSubstring("unknown shorthand flag")) + + session = podmanTest.Podman([]string{"create", "--detach", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + Expect(session.ErrorToString()).To(ContainSubstring("unknown flag")) + + session = podmanTest.Podman([]string{"create", "--detach-keys", "ctrl-x", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + Expect(session.ErrorToString()).To(ContainSubstring("unknown flag")) + }) + }) diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go index da2f67754..765844265 100644 --- a/test/e2e/generate_systemd_test.go +++ b/test/e2e/generate_systemd_test.go @@ -244,7 +244,7 @@ var _ = Describe("Podman generate systemd", func() { }) It("podman generate systemd --new with explicit detaching param in middle", func() { - n := podmanTest.Podman([]string{"create", "--name", "foo", "-d", "alpine", "top"}) + n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"}) n.WaitWithDefaultTimeout() Expect(n.ExitCode()).To(Equal(0)) @@ -253,7 +253,7 @@ var _ = Describe("Podman generate systemd", func() { Expect(session.ExitCode()).To(Equal(0)) // Grepping the output (in addition to unit tests) - found, _ := session.GrepString("--name foo -d alpine top") + found, _ := session.GrepString("--name foo alpine top") Expect(found).To(BeTrue()) }) diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go index baa5c5717..3e64cfda2 100644 --- a/test/e2e/init_test.go +++ b/test/e2e/init_test.go @@ -45,7 +45,7 @@ var _ = Describe("Podman init", func() { }) It("podman init single container by ID", func() { - session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToString() @@ -61,7 +61,7 @@ var _ = Describe("Podman init", func() { It("podman init single container by name", func() { name := "test1" - session := podmanTest.Podman([]string{"create", "--name", name, "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) init := podmanTest.Podman([]string{"init", name}) @@ -76,7 +76,7 @@ var _ = Describe("Podman init", func() { It("podman init latest container", func() { SkipIfRemote("--latest flag n/a") - session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) init := podmanTest.Podman([]string{"init", "--latest"}) @@ -90,10 +90,10 @@ var _ = Describe("Podman init", func() { }) It("podman init all three containers, one running", func() { - session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", "test1", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"create", "--name", "test2", "-d", ALPINE, "ls"}) + session2 := podmanTest.Podman([]string{"create", "--name", "test2", ALPINE, "ls"}) session2.WaitWithDefaultTimeout() Expect(session2.ExitCode()).To(Equal(0)) session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"}) diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 664d4831e..4214bd50e 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -148,7 +148,7 @@ var _ = Describe("Podman logs", func() { }) It("podman logs on a created container should result in 0 exit code", func() { - session := podmanTest.Podman([]string{"create", "-dt", "--name", "log", ALPINE}) + session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).To(Exit(0)) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 24643e6b2..24e945d5a 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -167,7 +167,7 @@ var _ = Describe("Podman pod rm", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "-d", "--pod", podid1, ALPINE, "ls"}) + session = podmanTest.Podman([]string{"create", "--pod", podid1, ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index c65738993..11d0b8c9b 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -324,7 +324,7 @@ var _ = Describe("Podman ps", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "-dt", ALPINE, "top"}) + session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 789b4dee5..114bd481a 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -54,7 +54,7 @@ var _ = Describe("Podman restart", func() { }) It("Podman restart stopped container by ID", func() { - session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToString() diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 540ac5409..9f6fd8602 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -357,7 +357,7 @@ var _ = Describe("Podman run networking", func() { }) It("podman run network expose ports in image metadata", func() { - session := podmanTest.Podman([]string{"create", "--name", "test", "-dt", "-P", nginx}) + session := podmanTest.Podman([]string{"create", "--name", "test", "-t", "-P", nginx}) session.Wait(90) Expect(session.ExitCode()).To(Equal(0)) results := podmanTest.Podman([]string{"inspect", "test"}) @@ -584,6 +584,14 @@ var _ = Describe("Podman run networking", func() { run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"}) run.WaitWithDefaultTimeout() Expect(run.ExitCode()).To(BeZero()) - Expect(strings.Contains(run.OutputToString(), "testctr")).To(BeTrue()) + Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue()) + }) + + It("podman run with --net=none adds hostname to /etc/hosts", func() { + hostname := "testctr" + run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"}) + run.WaitWithDefaultTimeout() + Expect(run.ExitCode()).To(BeZero()) + Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue()) }) }) diff --git a/test/e2e/run_security_labels.go b/test/e2e/run_security_labels.go index 2a0b0467d..0c5621e3f 100644 --- a/test/e2e/run_security_labels.go +++ b/test/e2e/run_security_labels.go @@ -94,7 +94,7 @@ var _ = Describe("Podman generate kube", func() { test1.WaitWithDefaultTimeout() Expect(test1.ExitCode()).To(BeZero()) - commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,net_raw", "test1", "image1"}) + commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,setuid", "test1", "image1"}) commit.WaitWithDefaultTimeout() Expect(commit.ExitCode()).To(BeZero()) @@ -108,7 +108,7 @@ var _ = Describe("Podman generate kube", func() { ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") - Expect(caps).To(Equal("CAP_SYS_CHROOT,CAP_NET_RAW")) + Expect(caps).To(Equal("CAP_SYS_CHROOT,CAP_SETUID")) }) diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index 92d3418e3..1c8a67123 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -489,7 +489,7 @@ VOLUME /test/` Expect(err).To(Not(BeNil())) // Make sure modifications in container disappear when container is stopped - session = podmanTest.Podman([]string{"create", "-d", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"}) + session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) session = podmanTest.Podman([]string{"start", "-l"}) diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index 1f1258be3..79fc4d737 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -1,8 +1,12 @@ package integration import ( + "io/ioutil" "os" + "os/exec" "path/filepath" + "strconv" + "strings" "github.com/containers/podman/v2/pkg/rootless" . "github.com/containers/podman/v2/test/utils" @@ -116,6 +120,71 @@ var _ = Describe("Podman save", func() { Expect(save).To(ExitWithError()) }) + It("podman save remove signature", func() { + SkipIfRootless("FIXME: Need get in rootless push sign") + if podmanTest.Host.Arch == "ppc64le" { + Skip("No registry image for ppc64le") + } + tempGNUPGHOME := filepath.Join(podmanTest.TempDir, "tmpGPG") + err := os.Mkdir(tempGNUPGHOME, os.ModePerm) + Expect(err).To(BeNil()) + origGNUPGHOME := os.Getenv("GNUPGHOME") + err = os.Setenv("GNUPGHOME", tempGNUPGHOME) + Expect(err).To(BeNil()) + defer os.Setenv("GNUPGHOME", origGNUPGHOME) + + port := 5000 + session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), "docker.io/registry:2.6"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { + Skip("Cannot start docker registry.") + } + + cmd := exec.Command("gpg", "--import", "sign/secret-key.asc") + err = cmd.Run() + Expect(err).To(BeNil()) + + cmd = exec.Command("cp", "/etc/containers/registries.d/default.yaml", "default.yaml") + if err = cmd.Run(); err != nil { + Skip("no signature store to verify") + } + defer func() { + cmd = exec.Command("cp", "default.yaml", "/etc/containers/registries.d/default.yaml") + cmd.Run() + }() + + cmd = exec.Command("cp", "sign/key.gpg", "/tmp/key.gpg") + Expect(cmd.Run()).To(BeNil()) + sigstore := ` +default-docker: + sigstore: file:///var/lib/containers/sigstore + sigstore-staging: file:///var/lib/containers/sigstore +` + Expect(ioutil.WriteFile("/etc/containers/registries.d/default.yaml", []byte(sigstore), 0755)).To(BeNil()) + + session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"push", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"rmi", ALPINE, "localhost:5000/alpine"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy=sign/policy.json", "localhost:5000/alpine"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + outfile := filepath.Join(podmanTest.TempDir, "temp.tar") + save := podmanTest.Podman([]string{"save", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"}) + save.WaitWithDefaultTimeout() + Expect(save).To(ExitWithError()) + }) + It("podman save image with digest reference", func() { // pull a digest reference session := podmanTest.PodmanNoCache([]string{"pull", ALPINELISTDIGEST}) diff --git a/test/e2e/sign/key.gpg b/test/e2e/sign/key.gpg new file mode 100644 index 000000000..32968fc04 --- /dev/null +++ b/test/e2e/sign/key.gpg @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBF8kNqwBCAC0x3Kog+WlDNwcR6rWIP8Gj2T6LrQ2/3knSyAWzTgC/OBB6Oh0 +KAokXLjy8J3diG3EaSltE7erGG/bZCz8jYvMiwDJScON4zzidotqjoY80E+NeRDg +CC0gqvqmh0ftJIjYNBHzSxqrGRQwzwZU+u6ezlE8+0dvsHcHY+MRnxXJQrdM07EP +Prp85kKckChDlJ1tyGUB/YHieFQmOW5+TERA7ZqQOAQ12Vviv6V4kNfEJJq3MS2c +csZpO323tcHt3oebqsZCIElhX7uVw6GAeCw1tm4NZXs4g1yIC21Of/hzPeC18F72 +splCgKaAOiE9w/nMGLNEYy2NzgEclZLs2Y7jABEBAAG0FGZvb2JhciA8Zm9vQGJh +ci5jb20+iQFUBBMBCAA+FiEERyT4ac7LLibByeabqaoHAy6P2bIFAl8kNqwCGwMF +CQPCZwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQqaoHAy6P2bKtuggAgv54 +/F8wgi+uMrtFr8rqNtZMDyXRxfXaXUy5uGNfqHD83yqxweEqxiA8lmFkRHixPWtg +Z2MniFXMVc9kVmg8GNIIuzewXrPqtXztvuURQo9phK68v8fXEqqT6K25wtq8TiQZ +0J3mQIJPPTMe3pCCOyR6+W3iMtQp2AmitxKbzLP3J3GG2i0rG5S147A2rPnzTeMY +hds819+JE7jNMD7FkV+TcQlOVl4wyOQhNEJcjb6rA6EUe5+s85pIFTBSyPMJpJ03 +Y0dLdcSGpKdncGTK2X9+hS96G1+FP/t8hRIDblqUHtBRXe3Ozz6zSqpqu1DbAQSM +bIrLYxXfnZEN+ro0dLkBDQRfJDasAQgAncvLLZUHZkJWDPka3ocysJ7+/lmrXyAj +T3D4r7UM4oaLBOMKjvaKSDw1uW5qYmTxnnsqFDI0O5+XJxD1/0qEf6l2oUpnILdx +Vruf28FuvymbsyhDgs+MBoHz0jLWWPHUW2oWLIqcvaF0BePQ1GS6UoZlmZejsLww +cSpbaAHJng7An/iLuqOBr5EdUA5XMXqmdMFDrjh0uZezImJ2Eacu/hshBdu3IY49 +J5XP18GWrSdUnP27cv3tOii9j5Lfl8QAvCN89vkALIU3eZtnMlWZqLgl5o6COVFm +zpyx+iHOoCznQBt0aGoSNmE/dAqWIQS/xCSFqMHI6kNd9N0oR0rEHwARAQABiQE8 +BBgBCAAmFiEERyT4ac7LLibByeabqaoHAy6P2bIFAl8kNqwCGwwFCQPCZwAACgkQ +qaoHAy6P2bJfjQgAje6YR+p1QaNlTN9l4t2kGzy9RhkfYMrTgI2fEqbS9bFJUy3Y +3mH+vj/r2gN/kaN8LHH4K1d7fAohBsFqSI0flzHHIx2rfti9zAlbXcAErbnG+f0f +k0AaqU7KelU35vjPfNe6Vn7ky6G9CC6jW04NkLZDNFA2GusdYf1aM0LWew5t4WZa +quLVFhL36q9eHaogO/fcPR/quvQefHokk+b541ytwMN9l/g43rTbCvAjrUDHwipb +Gbw91Wg2XjbecRiCXDKWds2M149BpxUzY5xHFtD5t5WSEE/SkkryGTMmTxS3tuQZ +9PdtCPGrNDO6Ts/amORF04Tf+YMJgfv3IWxMeQ== +=y0uZ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/test/e2e/sign/policy.json b/test/e2e/sign/policy.json new file mode 100644 index 000000000..ab01137bf --- /dev/null +++ b/test/e2e/sign/policy.json @@ -0,0 +1,18 @@ +{ + "default": [ + { + "type": "insecureAcceptAnything" + } + ], + "transports": { + "docker": { + "localhost:5000": [ + { + "type": "signedBy", + "keyType": "GPGKeys", + "keyPath": "/tmp/key.gpg" + } + ] + } + } +} diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index 35b5cab6e..942e00123 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -40,7 +40,7 @@ var _ = Describe("Podman start", func() { }) It("podman start single container by id", func() { - session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToString() @@ -50,7 +50,7 @@ var _ = Describe("Podman start", func() { }) It("podman container start single container by id", func() { - session := podmanTest.Podman([]string{"container", "create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToString() @@ -61,7 +61,7 @@ var _ = Describe("Podman start", func() { }) It("podman container start single container by short id", func() { - session := podmanTest.Podman([]string{"container", "create", "-d", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToString() @@ -74,7 +74,7 @@ var _ = Describe("Podman start", func() { It("podman start single container by name", func() { name := "foobar99" - session := podmanTest.Podman([]string{"create", "-d", "--name", name, ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) session = podmanTest.Podman([]string{"start", name}) @@ -98,10 +98,10 @@ var _ = Describe("Podman start", func() { }) It("podman start multiple containers", func() { - session := podmanTest.Podman([]string{"create", "-d", "--name", "foobar99", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", "foobar99", ALPINE, "ls"}) session.WaitWithDefaultTimeout() cid1 := session.OutputToString() - session2 := podmanTest.Podman([]string{"create", "-d", "--name", "foobar100", ALPINE, "ls"}) + session2 := podmanTest.Podman([]string{"create", "--name", "foobar100", ALPINE, "ls"}) session2.WaitWithDefaultTimeout() cid2 := session2.OutputToString() session = podmanTest.Podman([]string{"start", cid1, cid2}) @@ -110,7 +110,7 @@ var _ = Describe("Podman start", func() { }) It("podman start multiple containers with bogus", func() { - session := podmanTest.Podman([]string{"create", "-d", "--name", "foobar99", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", "foobar99", ALPINE, "ls"}) session.WaitWithDefaultTimeout() cid1 := session.OutputToString() session = podmanTest.Podman([]string{"start", cid1, "doesnotexist"}) diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index 1437fd066..c25709a63 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -242,7 +242,7 @@ var _ = Describe("Podman stop", func() { defer os.RemoveAll(tmpDir) - session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, "-d", ALPINE, "top"}) + session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid := session.OutputToStringArray()[0] diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go index 9e717a0eb..218c250cd 100644 --- a/test/e2e/systemd_test.go +++ b/test/e2e/systemd_test.go @@ -59,7 +59,7 @@ WantedBy=multi-user.target Expect(stop.ExitCode()).To(Equal(0)) }() - create := podmanTest.Podman([]string{"create", "-d", "--name", "redis", "redis"}) + create := podmanTest.Podman([]string{"create", "--name", "redis", "redis"}) create.WaitWithDefaultTimeout() Expect(create.ExitCode()).To(Equal(0)) diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index 4f0129a47..aa8a1f245 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -46,6 +46,7 @@ var _ = Describe("Podman wait", func() { Expect(session.ExitCode()).To(Equal(0)) session = podmanTest.Podman([]string{"wait", cid}) session.Wait() + Expect(session.ExitCode()).To(Equal(0)) }) It("podman wait on a sleeping container", func() { @@ -55,22 +56,60 @@ var _ = Describe("Podman wait", func() { Expect(session.ExitCode()).To(Equal(0)) session = podmanTest.Podman([]string{"wait", cid}) session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) }) It("podman wait on latest container", func() { session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"}) session.Wait(20) Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"wait", "-l"}) - session.Wait(20) + if IsRemote() { + session = podmanTest.Podman([]string{"wait", session.OutputToString()}) + } else { + session = podmanTest.Podman([]string{"wait", "-l"}) + } + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) }) It("podman container wait on latest container", func() { session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"}) session.Wait(20) Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"container", "wait", "-l"}) + if IsRemote() { + session = podmanTest.Podman([]string{"container", "wait", session.OutputToString()}) + } else { + session = podmanTest.Podman([]string{"container", "wait", "-l"}) + } + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman container wait on latest container with --interval flag", func() { + session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"}) session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"container", "wait", "-i", "5000", session.OutputToString()}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman container wait on latest container with --interval flag", func() { + session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"container", "wait", "--interval", "1s", session.OutputToString()}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman container wait on container with bogus --interval", func() { + session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"container", "wait", "--interval", "100days", session.OutputToString()}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) }) It("podman wait on three containers", func() { diff --git a/test/system/015-help.bats b/test/system/015-help.bats index 651fdcd09..22db8be8a 100644 --- a/test/system/015-help.bats +++ b/test/system/015-help.bats @@ -6,7 +6,7 @@ # provides its own --help output. If the usage message ends in '[command]', # treat it as a subcommand, and recurse into its own list of sub-subcommands. # -# Any usage message that ends in '[flags]' is interpreted as a command +# Any usage message that ends in '[options]' is interpreted as a command # that takes no further arguments; we confirm by running with 'invalid-arg' # and confirming that it exits with error status and message. # @@ -17,7 +17,7 @@ load helpers function podman_commands() { dprint "$@" run_podman help "$@" |\ - awk '/^Available Commands:/{ok=1;next}/^Flags:/{ok=0}ok { print $1 }' |\ + awk '/^Available Commands:/{ok=1;next}/^Options:/{ok=0}ok { print $1 }' |\ grep . "$output" } @@ -42,7 +42,7 @@ function check_help() { # e.g. 'podman ps' should not show 'podman container ps' in usage # Trailing space in usage handles 'podman system renumber' which - # has no ' [flags]' + # has no ' [options]' is "$usage " " $command_string .*" "Usage string matches command" # If usage ends in '[command]', recurse into subcommands @@ -52,25 +52,25 @@ function check_help() { continue fi - # We had someone write upper-case '[FLAGS]' once. Prevent it. - if expr "$usage" : '.*\[FLAG' >/dev/null; then - die "'flags' string must be lower-case in usage: $usage" + # We had someone write upper-case '[OPTIONS]' once. Prevent it. + if expr "$usage" : '.*\[OPTION' >/dev/null; then + die "'options' string must be lower-case in usage: $usage" fi - # We had someone do 'podman foo ARG [flags]' one time. Yeah, no. - if expr "$usage" : '.*[A-Z].*\[flag' >/dev/null; then - die "'flags' must precede arguments in usage: $usage" + # We had someone do 'podman foo ARG [options]' one time. Yeah, no. + if expr "$usage" : '.*[A-Z].*\[option' >/dev/null; then + die "'options' must precede arguments in usage: $usage" fi - # Cross-check: if usage includes '[flags]', there must be a - # longer 'Flags:' section in the full --help output; vice-versa, - # if 'Flags:' is in full output, usage line must have '[flags]'. - if expr "$usage" : '.*\[flag' >/dev/null; then - if ! expr "$full_help" : ".*Flags:" >/dev/null; then - die "$command_string: Usage includes '[flags]' but has no 'Flags:' subsection" + # Cross-check: if usage includes '[options]', there must be a + # longer 'Options:' section in the full --help output; vice-versa, + # if 'Options:' is in full output, usage line must have '[options]'. + if expr "$usage" : '.*\[option' >/dev/null; then + if ! expr "$full_help" : ".*Options:" >/dev/null; then + die "$command_string: Usage includes '[options]' but has no 'Options:' subsection" fi - elif expr "$full_help" : ".*Flags:" >/dev/null; then - die "$command_string: --help has 'Flags:' section but no '[flags]' in synopsis" + elif expr "$full_help" : ".*Options:" >/dev/null; then + die "$command_string: --help has 'Options:' section but no '[options]' in synopsis" fi # If usage lists no arguments (strings in ALL CAPS), confirm @@ -102,7 +102,7 @@ function check_help() { # If usage has required arguments, try running without them. # The expression here is 'first capital letter is not in [BRACKETS]'. - # It is intended to handle 'podman foo [flags] ARG' but not ' [ARG]'. + # It is intended to handle 'podman foo [options] ARG' but not ' [ARG]'. if expr "$usage" : '[^A-Z]\+ [A-Z]' >/dev/null; then # Exceptions: these commands don't work rootless if is_rootless; then diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 564de6a69..48f25f8d3 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -484,4 +484,23 @@ json-file | f run_podman kill $cid } +# Regression test for issue #8082 +@test "podman run : look up correct image name" { + # Create a 2nd tag for the local image. + local name="localhost/foo/bar" + run_podman tag $IMAGE $name + + # Create a container with the 2nd tag and make sure that it's being + # used. #8082 always inaccurately used the 1st tag. + run_podman create $name + cid="$output" + + run_podman inspect --format "{{.ImageName}}" $cid + is "$output" "$name" + + # Clean up. + run_podman rm $cid + run_podman untag $IMAGE $name +} + # vim: filetype=sh diff --git a/test/system/090-events.bats b/test/system/090-events.bats new file mode 100644 index 000000000..06e28ec3a --- /dev/null +++ b/test/system/090-events.bats @@ -0,0 +1,14 @@ +#!/usr/bin/env bats -*- bats -*- +# +# tests for podman events functionality +# + +load helpers + +@test "events with a filter by label" { + skip_if_remote "Need to talk to Ed on why this is failing on remote" + rand=$(random_string 30) + run_podman 0 run --label foo=bar --name test-$rand --rm $IMAGE ls + run_podman 0 events --filter type=container --filter container=test-$rand --filter label=foo=bar --filter event=start --stream=false + is "$output" ".*foo=bar" "check for label event on container with label" +} diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index 9bd3e15a1..ac3ae2f98 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -42,7 +42,7 @@ function teardown() { cname=$(random_string) # See #7407 for --pull=always. - run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top + run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" $IMAGE top run_podman generate systemd --new $cname echo "$output" > "$UNIT_FILE" |