mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
test/e2e: add regression testing for comma-containing labels
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
@ -392,6 +392,16 @@ LABEL "com.example.vendor"="Example Vendor"
|
||||
Expect(output).To(Equal("[]"))
|
||||
})
|
||||
|
||||
It("podman images --filter label=with,comma", func() {
|
||||
dockerfile := `FROM quay.io/libpod/alpine:latest
|
||||
`
|
||||
podmanTest.BuildImageWithLabel(dockerfile, "foobar.com/before:latest", "false", "test=with,comma")
|
||||
result := podmanTest.Podman([]string{"images", "--filter", "label=test=with,comma"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman images --filter readonly", func() {
|
||||
dockerfile := `FROM quay.io/libpod/alpine:latest
|
||||
`
|
||||
|
@ -437,7 +437,7 @@ var _ = Describe("Podman pause", func() {
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid2 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.RunTopContainer("")
|
||||
session1 = podmanTest.RunTopContainerWithArgs("", []string{"--label", "test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid3 := session1.OutputToString()
|
||||
@ -451,6 +451,16 @@ var _ = Describe("Podman pause", func() {
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(125))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
|
@ -87,7 +87,7 @@ var _ = Describe("Podman ps", func() {
|
||||
|
||||
It("podman pod ps --filter until", func() {
|
||||
name := "mypod"
|
||||
_, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}})
|
||||
_, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}, "--label": {"test=with,comma"}})
|
||||
Expect(ec).To(Equal(0))
|
||||
|
||||
result := podmanTest.Podman([]string{"pod", "ps", "--filter", "until=50"})
|
||||
@ -99,6 +99,11 @@ var _ = Describe("Podman ps", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(name))
|
||||
|
||||
result = podmanTest.Podman([]string{"pod", "ps", "--filter", "label=test=with,comma"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(name))
|
||||
})
|
||||
|
||||
It("podman pod ps filter name regexp", func() {
|
||||
|
@ -190,6 +190,26 @@ var _ = Describe("Podman ps", func() {
|
||||
Expect(actual).ToNot(ContainSubstring("table"))
|
||||
})
|
||||
|
||||
It("podman ps --filter label=test=with,comma", func() {
|
||||
ctrAlpha := "first"
|
||||
container := podmanTest.Podman([]string{"run", "-dt", "--label", "test=with,comma", "--name", ctrAlpha, ALPINE, "top"})
|
||||
container.WaitWithDefaultTimeout()
|
||||
Expect(container).Should(Exit(0))
|
||||
|
||||
ctrBravo := "second"
|
||||
containerBravo := podmanTest.Podman([]string{"run", "-dt", "--name", ctrBravo, ALPINE, "top"})
|
||||
containerBravo.WaitWithDefaultTimeout()
|
||||
Expect(containerBravo).Should(Exit(0))
|
||||
|
||||
result := podmanTest.Podman([]string{"ps", "-a", "--format", "table {{.Names}}", "--filter", "label=test=with,comma"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
actual := result.OutputToString()
|
||||
Expect(actual).To(ContainSubstring("first"))
|
||||
Expect(actual).ToNot(ContainSubstring("table"))
|
||||
})
|
||||
|
||||
It("podman ps namespace flag", func() {
|
||||
_, ec, _ := podmanTest.RunLsContainer("")
|
||||
Expect(ec).To(Equal(0))
|
||||
|
@ -311,7 +311,7 @@ var _ = Describe("Podman restart", func() {
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid2 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.RunTopContainer("")
|
||||
session1 = podmanTest.RunTopContainerWithArgs("", []string{"--label", "test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid3 := session1.OutputToString()
|
||||
@ -331,6 +331,11 @@ var _ = Describe("Podman restart", func() {
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"restart", "-f", fmt.Sprintf("id=%s", cid2)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
|
@ -292,6 +292,11 @@ var _ = Describe("Podman rm", func() {
|
||||
cid3 := session1.OutputToString()
|
||||
shortCid3 := cid3[0:5]
|
||||
|
||||
session1 = podmanTest.RunTopContainerWithArgs("test4", []string{"--label", "test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid4 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.Podman([]string{"rm", cid1, "-f", "--filter", "status=running"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(125))
|
||||
@ -311,5 +316,10 @@ var _ = Describe("Podman rm", func() {
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"rm", "-f", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid4))
|
||||
})
|
||||
})
|
||||
|
@ -229,7 +229,7 @@ var _ = Describe("Podman secret", func() {
|
||||
Expect(list.OutputToStringArray()).To(HaveLen(2))
|
||||
Expect(list.OutputToStringArray()[1]).To(ContainSubstring(secrID2))
|
||||
|
||||
list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s,name=%s", secret1, secret2)})
|
||||
list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s", secret1), "--filter", fmt.Sprintf("name=%s", secret2)})
|
||||
list.WaitWithDefaultTimeout()
|
||||
Expect(list).Should(Exit(0))
|
||||
Expect(list.OutputToStringArray()).To(HaveLen(3))
|
||||
|
@ -208,6 +208,11 @@ var _ = Describe("Podman start", func() {
|
||||
cid3 := session1.OutputToString()
|
||||
shortCid3 := cid3[0:5]
|
||||
|
||||
session1 = podmanTest.Podman([]string{"container", "create", "--label", "test=with,comma", ALPINE})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid4 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
@ -223,6 +228,11 @@ var _ = Describe("Podman start", func() {
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid4))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"start", "-f", fmt.Sprintf("id=%s", cid2)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
|
@ -382,6 +382,11 @@ var _ = Describe("Podman stop", func() {
|
||||
cid3 := session1.OutputToString()
|
||||
shortCid3 := cid3[0:5]
|
||||
|
||||
session1 = podmanTest.Podman([]string{"container", "create", "--label", "test=with,comma", ALPINE})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
cid4 := session1.OutputToString()
|
||||
|
||||
session1 = podmanTest.Podman([]string{"start", "--all"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
@ -400,6 +405,11 @@ var _ = Describe("Podman stop", func() {
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", "label=test=with,comma"})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
Expect(session1.OutputToString()).To(BeEquivalentTo(cid4))
|
||||
|
||||
session1 = podmanTest.Podman([]string{"stop", "-f", fmt.Sprintf("id=%s", cid2)})
|
||||
session1.WaitWithDefaultTimeout()
|
||||
Expect(session1).Should(Exit(0))
|
||||
|
@ -26,6 +26,17 @@ var _ = Describe("Podman volume ls", func() {
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman ls volume filter with comma label", func() {
|
||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "test=with,comma", "myvol3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=test=with,comma"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman ls volume filter with a key pattern", func() {
|
||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "helloworld=world", "myvol2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
Reference in New Issue
Block a user