test: add restart ocid with pod stopped test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
d9edbe6817
commit
f22dc5244f
2 changed files with 36 additions and 0 deletions
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue