aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-12-11 09:34:58 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 22:22:56 +0000
commit3ba2c3e11791b9da11661ea45d966d2db621a6ac (patch)
treeba83d175492e64b2949b27113cc4bdb98cc8f98a /test
parentbbe6b21cb802737f933305f7c2013a86349ba43c (diff)
downloadpodman-3ba2c3e11791b9da11661ea45d966d2db621a6ac.tar.gz
podman-3ba2c3e11791b9da11661ea45d966d2db621a6ac.tar.bz2
podman-3ba2c3e11791b9da11661ea45d966d2db621a6ac.zip
kpod top
Display information about processes in a running container. Signed-off-by: baude <bbaude@redhat.com> Closes: #121 Approved by: rhatdan
Diffstat (limited to 'test')
-rw-r--r--test/kpod_top.bats51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/kpod_top.bats b/test/kpod_top.bats
new file mode 100644
index 000000000..189772a11
--- /dev/null
+++ b/test/kpod_top.bats
@@ -0,0 +1,51 @@
+#!/usr/bin/env bats
+
+load helpers
+
+function teardown() {
+ cleanup_test
+}
+
+function setup() {
+ copy_images
+}
+
+@test "top without container name or id" {
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} top
+ echo "$output"
+ [ "$status" -eq 1 ]
+}
+
+@test "top a bogus container" {
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} top foobar
+ echo "$output"
+ [ "$status" -eq 1 ]
+}
+
+@test "top non-running container by id with defaults" {
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} create -d ${ALPINE} sleep 60
+ [ "$status" -eq 0 ]
+ ctr_id="$output"
+ run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id"
+ echo "$output"
+ [ "$status" -eq 1 ]
+}
+
+@test "top running container by id with defaults" {
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} run -dt ${ALPINE} /bin/sh
+ [ "$status" -eq 0 ]
+ ctr_id="$output"
+ echo $ctr_id
+ run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id"
+ echo "$output"
+ [ "$status" -eq 0 ]
+}
+
+@test "top running container by id with ps opts" {
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 60
+ [ "$status" -eq 0 ]
+ ctr_id="$output"
+ run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id -o fuser,f,comm,label"
+ echo "$output"
+ [ "$status" -eq 0 ]
+}