aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/80-kube.at24
-rw-r--r--test/e2e/stop_test.go42
-rw-r--r--test/system/090-events.bats4
-rw-r--r--test/system/700-play.bats16
4 files changed, 66 insertions, 20 deletions
diff --git a/test/apiv2/80-kube.at b/test/apiv2/80-kube.at
index 40b26d75e..f40a6556e 100644
--- a/test/apiv2/80-kube.at
+++ b/test/apiv2/80-kube.at
@@ -37,13 +37,29 @@ t DELETE libpod/containers/$cid 200 .[0].Id=$cid
# Make sure that kube-play works
-t POST libpod/kube/play $YAML 200
-t DELETE libpod/kube/play $YAML 200
+t POST libpod/kube/play $YAML 200 \
+ .Pods[0].ID~[0-9a-f]\\{64\\} \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~[0-9a-f]\\{64\\}
+
+t DELETE libpod/kube/play $YAML 200 \
+ .Pods[0].ID~null \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~null
# Make sure that play-kube works
-t POST libpod/play/kube $YAML 200
-t DELETE libpod/play/kube $YAML 200
+t POST libpod/play/kube $YAML 200 \
+ .Pods[0].ID~[0-9a-f]\\{64\\} \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~[0-9a-f]\\{64\\}
+
+t DELETE libpod/play/kube $YAML 200 \
+ .Pods[0].ID~null \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~null \
+ .StopReport[0].Id~[0-9a-f]\\{64\\} \
+ .RmReport[0].Id~[0-9a-f]\\{64\\}
rm -rf $TMPD
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 97d8ba701..7a258466a 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
"strings"
@@ -363,4 +364,45 @@ var _ = Describe("Podman stop", func() {
Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
+
+ It("podman stop --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", "--all"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+
+ session1 = podmanTest.Podman([]string{"stop", cid1, "-f", "status=running"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(125))
+
+ session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(HaveLen(0))
+
+ session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
+
+ session1 = podmanTest.Podman([]string{"stop", "-f", fmt.Sprintf("id=%s", cid2)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
+ })
})
diff --git a/test/system/090-events.bats b/test/system/090-events.bats
index 128802360..ceb53ae73 100644
--- a/test/system/090-events.bats
+++ b/test/system/090-events.bats
@@ -13,11 +13,11 @@ load helpers
run_podman run --label $labelname=$labelvalue --name $cname --rm $IMAGE ls
expect=".* container start [0-9a-f]\+ (image=$IMAGE, name=$cname,.* ${labelname}=${labelvalue}"
- run_podman events --filter type=container --filter container=$cname --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
+ run_podman events --filter type=container -f container=$cname --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
is "$output" "$expect" "filtering by container name and label"
# Same thing, but without the container-name filter
- run_podman events --filter type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
+ run_podman events -f type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
is "$output" "$expect" "filtering just by label"
# Now filter just by container name, no label
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 53e9a5274..72602a9e6 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -86,21 +86,9 @@ RELABEL="system_u:object_r:container_file_t:s0"
run_podman pod rm -t 0 -f test_pod
}
-@test "podman kube" {
- TESTDIR=$PODMAN_TMPDIR/testdir
- mkdir -p $TESTDIR
- echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
- run_podman kube play $PODMAN_TMPDIR/test.yaml
- if [ -e /usr/sbin/selinuxenabled -a /usr/sbin/selinuxenabled ]; then
- run ls -Zd $TESTDIR
- is "$output" "${RELABEL} $TESTDIR" "selinux relabel should have happened"
- fi
-
- run_podman stop -a -t 0
- run_podman pod rm -t 0 -f test_pod
-}
-
@test "podman play" {
+ # Testing that the "podman play" cmd still works now that
+ # "podman kube" is an option.
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml