2016-12-16 23:34:51 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
IMAGE=kubernetes/pause
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
cleanup_test
|
|
|
|
}
|
|
|
|
|
2017-01-31 15:32:27 +00:00
|
|
|
@test "run container in pod with image ID" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
|
|
|
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
2017-01-31 15:32:27 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
|
|
|
sed -e "s/%VALUE%/$REDIS_IMAGEID/g" "$TESTDATA"/container_config_by_imageid.json > "$TESTDIR"/ctr_by_imageid.json
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl ctr create --config "$TESTDIR"/ctr_by_imageid.json --pod "$pod_id"
|
2017-01-31 15:32:27 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2017-01-31 15:32:27 +00:00
|
|
|
}
|
|
|
|
|
2016-12-16 23:34:51 +00:00
|
|
|
@test "image pull" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio "" "" --no-pause-image
|
|
|
|
run crioctl image pull "$IMAGE"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
cleanup_images
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-16 23:34:51 +00:00
|
|
|
}
|
|
|
|
|
2017-04-06 17:28:55 +00:00
|
|
|
@test "image pull and list by digest" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio "" "" --no-pause-image
|
|
|
|
run crioctl image pull nginx@sha256:4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
|
2017-04-06 17:28:55 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet nginx@sha256:4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
echo "$output"
|
|
|
|
[ "$output" != "" ]
|
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet nginx@4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
echo "$output"
|
|
|
|
[ "$output" != "" ]
|
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet @4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
echo "$output"
|
|
|
|
[ "$output" != "" ]
|
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet 4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
echo "$output"
|
|
|
|
[ "$output" != "" ]
|
|
|
|
|
|
|
|
cleanup_images
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2017-04-06 17:28:55 +00:00
|
|
|
}
|
|
|
|
|
2016-12-16 23:34:51 +00:00
|
|
|
@test "image list with filter" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio "" "" --no-pause-image
|
|
|
|
run crioctl image pull "$IMAGE"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet "$IMAGE"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image remove --id "$id"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
done
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
|
|
|
echo "$id"
|
|
|
|
status=1
|
|
|
|
done
|
|
|
|
cleanup_images
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-16 23:34:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "image list/remove" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio "" "" --no-pause-image
|
|
|
|
run crioctl image pull "$IMAGE"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$output" != "" ]
|
2016-12-16 23:34:51 +00:00
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image remove --id "$id"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
done
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$output" = "" ]
|
2016-12-16 23:34:51 +00:00
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
|
|
|
echo "$id"
|
|
|
|
status=1
|
|
|
|
done
|
|
|
|
cleanup_images
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-16 23:34:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "image status/remove" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio "" "" --no-pause-image
|
|
|
|
run crioctl image pull "$IMAGE"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$output" != "" ]
|
2016-12-16 23:34:51 +00:00
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image status --id "$id"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$output" != "" ]
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image remove --id "$id"
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
done
|
2017-05-12 13:36:15 +00:00
|
|
|
run crioctl image list --quiet
|
2016-12-16 23:34:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-04-06 17:28:55 +00:00
|
|
|
[ "$output" = "" ]
|
2016-12-16 23:34:51 +00:00
|
|
|
printf '%s\n' "$output" | while IFS= read -r id; do
|
|
|
|
echo "$id"
|
|
|
|
status=1
|
|
|
|
done
|
|
|
|
cleanup_images
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-16 23:34:51 +00:00
|
|
|
}
|