test: add restart ocid with pod stopped test

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-12-09 11:56:25 +01:00
parent d9edbe6817
commit f22dc5244f
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 36 additions and 0 deletions

View file

@ -143,6 +143,16 @@ function stop_ocid() {
fi
}
function restart_ocid() {
if [ "$OCID_PID" != "" ]; then
kill "$OCID_PID" >/dev/null 2>&1
start_ocid
else
echo "you must start ocid first"
exit 1
fi
}
function cleanup_test() {
rm -rf "$TESTDIR"
}

View file

@ -306,3 +306,29 @@ function teardown() {
cleanup_pods
stop_ocid
}
@test "restart ocid and still get pod status" {
# this test requires docker, thus it can't yet be run in a container
if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here
skip "cannot yet run this test in a container, use sudo make localintegration"
fi
start_ocid
run ocic pod create --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run ocic pod stop --id "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
restart_ocid
run ocic pod status --id "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
[ "$output" != "" ]
cleanup_ctrs
cleanup_pods
stop_ocid
}