summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorKarthik Elango <kelango@redhat.com>2022-07-27 10:43:06 -0400
committerKarthik Elango <kelango@redhat.com>2022-08-04 09:08:14 -0400
commit9964366f69a1fbaa709e45c3d3ebcada283a76b7 (patch)
treef10f06e9e57d59e964f17056edba4f89c1836069 /test/e2e
parent47a814aa6df97da834315d778cb68f66a82c3231 (diff)
downloadpodman-9964366f69a1fbaa709e45c3d3ebcada283a76b7.tar.gz
podman-9964366f69a1fbaa709e45c3d3ebcada283a76b7.tar.bz2
podman-9964366f69a1fbaa709e45c3d3ebcada283a76b7.zip
start filter flag changes
Tying filtering logic for podman stop and start to same place in getContainersAndInputByContext() to reduce code redundancy Signed-off-by: Karthik Elango <kelango@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/start_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index 73af9d12c..736008ed3 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
"strconv"
@@ -231,4 +232,42 @@ var _ = Describe("Podman start", func() {
_, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
Expect(err).To(BeNil())
})
+
+ It("podman start container --filter", func() {
+ session1 := podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid1 := session1.OutputToString()
+
+ session1 = podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid2 := session1.OutputToString()
+
+ session1 = podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid3 := session1.OutputToString()
+ shortCid3 := cid3[0:5]
+
+ session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(HaveLen(0))
+
+ session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(HaveLen(0))
+
+ session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
+
+ session1 = podmanTest.Podman([]string{"start", "-f", fmt.Sprintf("id=%s", cid2)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
+ })
})