summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2022-08-19 16:38:49 -0400
committerAshley Cui <acui@redhat.com>2022-08-22 09:13:00 -0400
commiteee0ec97e8eb7436208b7852e7e9ee5974384395 (patch)
treeeb66a474eb9194049859bf59e463fd079b9dd045 /test
parent351028b1ac87851fc084b8b5e09eb80660e6bb5a (diff)
downloadpodman-eee0ec97e8eb7436208b7852e7e9ee5974384395.tar.gz
podman-eee0ec97e8eb7436208b7852e7e9ee5974384395.tar.bz2
podman-eee0ec97e8eb7436208b7852e7e9ee5974384395.zip
Add quiet/q flag to podman secret ls
Add quiet/q flag to podman secret ls, which will print only the secret ID. Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/secret_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index ed328d84a..3360c4059 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -145,6 +145,36 @@ var _ = Describe("Podman secret", func() {
})
+ It("podman secret ls --quiet", func() {
+ secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
+ err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
+ Expect(err).To(BeNil())
+
+ secretName := "a"
+
+ session := podmanTest.Podman([]string{"secret", "create", secretName, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ secretID := session.OutputToString()
+
+ list := podmanTest.Podman([]string{"secret", "ls", "-q"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretID))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--quiet"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretID))
+
+ // Prefer format over quiet
+ list = podmanTest.Podman([]string{"secret", "ls", "-q", "--format", "{{.Name}}"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretName))
+
+ })
+
It("podman secret ls with filters", func() {
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)