fixups for tests

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-10-08 14:57:45 +02:00
parent cfa4a341a6
commit 9b72f29b72
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
4 changed files with 23 additions and 3 deletions

View file

@ -33,6 +33,7 @@ function teardown() {
run ocic pod remove --id "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
stop_ocid
}
@ -103,6 +104,7 @@ function teardown() {
run ocic ctr list
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
stop_ocid
}

View file

@ -76,6 +76,19 @@ function start_ocid() {
wait_until_reachable
}
function cleanup_ctrs() {
run ocic ctr list --quiet
if [ "$status" -eq 0 ]; then
if [ "$output" != "" ]; then
printf '%s\n' "$output" | while IFS= read -r line
do
ocic ctr stop --id "$line"
ocic ctr remove --id "$line"
done
fi
fi
}
function cleanup_pods() {
run ocic pod list --quiet
if [ "$status" -eq 0 ]; then
@ -92,7 +105,7 @@ function cleanup_pods() {
# Stop ocid.
function stop_ocid() {
if [ "$OCID_PID" != "" ]; then
kill -9 "$OCID_PID" >/dev/null 2>&1
kill "$OCID_PID" >/dev/null 2>&1
fi
}

View file

@ -35,6 +35,7 @@ function teardown() {
run ocic pod remove --id "$id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
stop_ocid
}
@ -60,6 +61,7 @@ function teardown() {
run ocic pod remove --id "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
stop_ocid
}

View file

@ -29,13 +29,16 @@ function teardown() {
run ocic pod list
echo "$output"
[ "$status" -eq 0 ]
#[[ "${output}" == *'${pod_id}'* ]]
[[ "${output}" != "" ]]
[[ "${output}" =~ "${pod_id}" ]]
run ocic ctr list
echo "$output"
[ "$status" -eq 0 ]
#[[ "${output}" == *'${pod_id}'* ]]
[[ "${output}" != "" ]]
[[ "${output}" =~ "${pod_id}" ]]
cleanup_ctrs
cleanup_pods
stop_ocid
}