podman/test/podman_top.bats
Daniel J Walsh 5770dc2640 Rename all references to kpod to podman
The decision is in, kpod is going to be named podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #145
Approved by: umohnani8
2017-12-18 16:46:05 +00:00

53 lines
1.3 KiB
Bash

#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
prepare_network_conf
copy_images
}
@test "top without container name or id" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top
echo "$output"
[ "$status" -eq 1 ]
}
@test "top a bogus container" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top foobar
echo "$output"
[ "$status" -eq 1 ]
}
@test "top non-running container by id with defaults" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} sleep 60
[ "$status" -eq 0 ]
ctr_id="$output"
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id"
echo "$output"
[ "$status" -eq 1 ]
}
@test "top running container by id with defaults" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt ${ALPINE} /bin/sh
[ "$status" -eq 0 ]
ctr_id="$output"
echo $ctr_id
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id"
echo "$output"
[ "$status" -eq 0 ]
}
@test "top running container by id with ps opts" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 60
[ "$status" -eq 0 ]
ctr_id="$output"
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id -o fuser,f,comm,label"
echo "$output"
[ "$status" -eq 0 ]
}