summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-14 18:40:58 +0100
committerGitHub <noreply@github.com>2021-12-14 18:40:58 +0100
commita0894b5ecd6c64d30b82a7b79bc1e2e87c7f0a4e (patch)
treef29f820c85da215b2783ceab5d8284698ce85150 /test
parent1884bd8873b6e60c0a590424cadd192cafb26c5f (diff)
parent50501f49a327a2f5c7f1c6746f9fde482c877387 (diff)
downloadpodman-a0894b5ecd6c64d30b82a7b79bc1e2e87c7f0a4e.tar.gz
podman-a0894b5ecd6c64d30b82a7b79bc1e2e87c7f0a4e.tar.bz2
podman-a0894b5ecd6c64d30b82a7b79bc1e2e87c7f0a4e.zip
Merge pull request #12586 from jmguzik/secret-cmd
Add secret list --filter to cli
Diffstat (limited to 'test')
-rw-r--r--test/e2e/secret_test.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 661ebbdc0..f08638b1b 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -145,6 +146,54 @@ var _ = Describe("Podman secret", func() {
})
+ It("podman secret ls with filters", func() {
+ secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
+ err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
+ Expect(err).To(BeNil())
+
+ secret1 := "Secret1"
+ secret2 := "Secret2"
+
+ session := podmanTest.Podman([]string{"secret", "create", secret1, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ secrID1 := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"secret", "create", secret2, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ secrID2 := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"secret", "create", "Secret3", secretFilePath})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ list := podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s", secret1)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secret1))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s", secret2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secret2))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("id=%s", secrID1)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secrID1))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("id=%s", secrID2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secrID2))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s,name=%s", secret1, secret2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(3), ContainSubstring(secret1), ContainSubstring(secret2))
+ })
+
It("podman secret ls with Go template", func() {
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)