replace crioctl with crictl
Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
This commit is contained in:
parent
7b837b5a1e
commit
25dfde9044
28 changed files with 457 additions and 457 deletions
|
@ -96,9 +96,9 @@ function teardown() {
|
|||
cleanup_test
|
||||
}
|
||||
|
||||
@test "crioctl runtimeversion" {
|
||||
@test "crictl runtimeversion" {
|
||||
start_crio
|
||||
crioctl runtimeversion
|
||||
crictl runtimeversion
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
|
|
|
@ -19,19 +19,18 @@ function teardown() {
|
|||
|
||||
sed -e 's/%VALUE%/,"container\.apparmor\.security\.beta\.kubernetes\.io\/testname1": "runtime\/default"/g' "$TESTDATA"/sandbox_config_seccomp.json > "$TESTDIR"/apparmor1.json
|
||||
|
||||
run crioctl pod run --name apparmor1 --config "$TESTDIR"/apparmor1.json
|
||||
run crictl runs "$TESTDIR"/apparmor1.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname1 --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/apparmor1.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" touch test.txt
|
||||
run crictl exec --sync "$ctr_id" touch test.txt
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_crio
|
||||
|
@ -51,15 +50,15 @@ function teardown() {
|
|||
|
||||
sed -e 's/%VALUE%/,"container\.apparmor\.security\.beta\.kubernetes\.io\/testname2": "apparmor-test-deny-write"/g' "$TESTDATA"/sandbox_config_seccomp.json > "$TESTDIR"/apparmor2.json
|
||||
|
||||
run crioctl pod run --name apparmor2 --config "$TESTDIR"/apparmor2.json
|
||||
run crictl runs "$TESTDIR"/apparmor2.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname2 --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/apparmor2.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" touch test.txt
|
||||
run crictl exec --sync "$ctr_id" touch test.txt
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "$output" =~ "Permission denied" ]]
|
||||
|
@ -84,15 +83,15 @@ function teardown() {
|
|||
|
||||
sed -e 's/%VALUE%/,"container\.apparmor\.security\.beta\.kubernetes\.io\/testname3": "apparmor-test-deny-write"/g' "$TESTDATA"/sandbox_config_seccomp.json > "$TESTDIR"/apparmor3.json
|
||||
|
||||
run crioctl pod run --name apparmor3 --config "$TESTDIR"/apparmor3.json
|
||||
run crictl runs "$TESTDIR"/apparmor3.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname3 --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/apparmor3.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" touch test.txt
|
||||
run crictl exec --sync "$ctr_id" touch test.txt
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "$output" =~ "Permission denied" ]]
|
||||
|
@ -116,16 +115,15 @@ function teardown() {
|
|||
|
||||
sed -e 's/%VALUE%/,"container\.apparmor\.security\.beta\.kubernetes\.io\/testname4": "not-exists"/g' "$TESTDATA"/sandbox_config_seccomp.json > "$TESTDIR"/apparmor4.json
|
||||
|
||||
run crioctl pod run --name apparmor4 --config "$TESTDIR"/apparmor4.json
|
||||
run crictl runs "$TESTDIR"/apparmor4.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname4 --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/apparmor4.json
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "$output" =~ "Creating container failed" ]]
|
||||
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_crio
|
||||
|
@ -145,19 +143,18 @@ function teardown() {
|
|||
|
||||
sed -e 's/%VALUE%/,"container\.apparmor\.security\.beta\.kubernetes\.io\/testname5": "runtime\/default"/g' "$TESTDATA"/sandbox_config_seccomp.json > "$TESTDIR"/apparmor5.json
|
||||
|
||||
run crioctl pod run --name apparmor5 --config "$TESTDIR"/apparmor5.json
|
||||
run crictl runs "$TESTDIR"/apparmor5.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname5 --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/apparmor5.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" touch test.txt
|
||||
run crictl exec --sync "$ctr_id" touch test.txt
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_crio
|
||||
|
|
|
@ -11,27 +11,27 @@ function teardown() {
|
|||
skip "pids cgroup controller is not mounted"
|
||||
fi
|
||||
PIDS_LIMIT=1234 start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
pids_limit_config=$(cat "$TESTDATA"/container_config.json | python -c 'import json,sys;obj=json.load(sys.stdin); obj["command"] = ["/bin/sleep", "600"]; json.dump(obj, sys.stdout)')
|
||||
echo "$pids_limit_config" > "$TESTDIR"/container_pids_limit.json
|
||||
run crioctl ctr create --config "$TESTDIR"/container_pids_limit.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/container_pids_limit.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" cat /sys/fs/cgroup/pids/pids.max
|
||||
run crictl exec --sync "$ctr_id" cat /sys/fs/cgroup/pids/pids.max
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "1234" ]]
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
|
|
467
test/ctr.bats
467
test/ctr.bats
File diff suppressed because it is too large
Load diff
|
@ -22,18 +22,18 @@ function teardown() {
|
|||
start_crio "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's/%VALUE%/unconfined/g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp1.json
|
||||
run crioctl pod run --name seccomp1 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname --config "$TESTDIR"/seccomp1.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/seccomp1.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" chmod 777 .
|
||||
run crictl exec --sync "$ctr_id" chmod 777 .
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -58,18 +58,18 @@ function teardown() {
|
|||
start_crio "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's/%VALUE%/runtime\/default/g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp2.json
|
||||
run crioctl pod run --name seccomp2 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname2 --config "$TESTDIR"/seccomp2.json --pod "$pod_id"
|
||||
run crictl create "$TESTDIR"/seccomp2.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" chmod 777 .
|
||||
run crictl exec --sync "$ctr_id" chmod 777 .
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 1" ]]
|
||||
|
@ -96,18 +96,18 @@ function teardown() {
|
|||
start_crio "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's/%VALUE%//g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp1.json
|
||||
run crioctl pod run --name seccomp1 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname --config "$TESTDIR"/seccomp1.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/seccomp1.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" chmod 777 .
|
||||
run crictl exec --sync "$ctr_id" chmod 777 .
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -131,11 +131,11 @@ function teardown() {
|
|||
start_crio "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's/%VALUE%/wontwork/g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp1.json
|
||||
run crioctl pod run --name seccomp1 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname --config "$TESTDIR"/seccomp1.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/seccomp1.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[[ "$status" -ne 0 ]]
|
||||
[[ "$output" =~ "unknown seccomp profile option:" ]]
|
||||
|
@ -161,18 +161,18 @@ function teardown() {
|
|||
sed -i 's/"fchmodat",//g' "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's@%VALUE%@localhost/'"$TESTDIR"'/seccomp_profile1.json@g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp1.json
|
||||
run crioctl pod run --name seccomp1 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname --config "$TESTDIR"/seccomp1.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/seccomp1.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" chmod 777 .
|
||||
run crictl exec --sync "$ctr_id" chmod 777 .
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 1" ]]
|
||||
[[ "$output" =~ "Operation not permitted" ]]
|
||||
|
@ -198,18 +198,18 @@ function teardown() {
|
|||
start_crio "$TESTDIR"/seccomp_profile1.json
|
||||
|
||||
sed -e 's/%VALUE%/docker\/default/g' "$TESTDATA"/container_config_seccomp.json > "$TESTDIR"/seccomp2.json
|
||||
run crioctl pod run --name seccomp2 --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --name testname2 --config "$TESTDIR"/seccomp2.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/seccomp2.json "$TESTDIR"/seccomp_profile1.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" chmod 777 .
|
||||
run crictl exec --sync "$ctr_id" chmod 777 .
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 1" ]]
|
||||
|
|
|
@ -10,17 +10,17 @@ function teardown() {
|
|||
|
||||
@test "bind secrets mounts to container" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" cat /proc/mounts
|
||||
run crictl exec --sync "$ctr_id" cat /proc/mounts
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
mount_info="$output"
|
||||
|
@ -34,32 +34,32 @@ function teardown() {
|
|||
|
||||
@test "default mounts correctly sorted with other mounts" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
[ "$status" -eq 0 ]
|
||||
host_path="$TESTDIR"/clash
|
||||
mkdir "$host_path"
|
||||
echo "clashing..." > "$host_path"/clashing.txt
|
||||
sed -e "s,%HPATH%,$host_path,g" "$TESTDATA"/container_redis_default_mounts.json > "$TESTDIR"/defmounts_pre.json
|
||||
sed -e 's,%CPATH%,\/container\/path1\/clash,g' "$TESTDIR"/defmounts_pre.json > "$TESTDIR"/defmounts.json
|
||||
run crioctl ctr create --config "$TESTDIR"/defmounts.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/defmounts.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr execsync --id "$ctr_id" ls -la /container/path1/clash
|
||||
run crictl exec --sync "$ctr_id" ls -la /container/path1/clash
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" cat /container/path1/clash/clashing.txt
|
||||
run crictl exec --sync "$ctr_id" cat /container/path1/clash/clashing.txt
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "clashing..." ]]
|
||||
run crioctl ctr execsync --id "$ctr_id" ls -la /container/path1
|
||||
run crictl exec --sync "$ctr_id" ls -la /container/path1
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" cat /container/path1/test.txt
|
||||
run crictl exec --sync "$ctr_id" cat /container/path1/test.txt
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Testing secrets mounts!" ]]
|
||||
|
|
|
@ -169,13 +169,6 @@ function crio() {
|
|||
"$CRIO_BINARY" --listen "$CRIO_SOCKET" "$@"
|
||||
}
|
||||
|
||||
# DEPRECATED
|
||||
OCIC_BINARY=${OCIC_BINARY:-${CRIO_ROOT}/cri-o/bin/crioctl}
|
||||
# Run crioctl using the binary specified by $OCIC_BINARY.
|
||||
function crioctl() {
|
||||
"$OCIC_BINARY" --connect "$CRIO_SOCKET" "$@"
|
||||
}
|
||||
|
||||
# Run crictl using the binary specified by $CRICTL_BINARY.
|
||||
function crictl() {
|
||||
"$CRICTL_BINARY" -r "$CRIO_SOCKET" -i "$CRIO_SOCKET" "$@"
|
||||
|
@ -444,7 +437,7 @@ EOF
|
|||
}
|
||||
|
||||
function check_pod_cidr() {
|
||||
run crioctl ctr execsync --id $1 ip addr show dev eth0 scope global 2>&1
|
||||
run crictl exec --sync $1 ip addr show dev eth0 scope global 2>&1
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ $POD_CIDR_MASK ]]
|
||||
|
@ -468,7 +461,7 @@ function get_host_ip() {
|
|||
}
|
||||
|
||||
function ping_pod() {
|
||||
inet=`crioctl ctr execsync --id $1 ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
inet=`crictl exec --sync $1 ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
|
||||
IFS=" "
|
||||
ip=`parse_pod_ip $inet`
|
||||
|
@ -479,12 +472,12 @@ function ping_pod() {
|
|||
}
|
||||
|
||||
function ping_pod_from_pod() {
|
||||
inet=`crioctl ctr execsync --id $1 ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
inet=`crictl exec --sync $1 ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
|
||||
IFS=" "
|
||||
ip=`parse_pod_ip $inet`
|
||||
|
||||
run crioctl ctr execsync --id $2 ping -W 1 -c 2 $ip
|
||||
run crictl exec --sync $2 ping -W 1 -c 2 $ip
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
|
|
@ -12,21 +12,21 @@ sed "s|HOOKSDIR|${HOOKSDIR}|" hooks/checkhook.json > ${HOOKSDIR}/checkhook.json
|
|||
@test "pod test hooks" {
|
||||
rm -f /run/hookscheck
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run cat /run/hookscheck
|
||||
|
|
|
@ -12,12 +12,12 @@ function teardown() {
|
|||
|
||||
@test "run container in pod with image ID" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
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
|
||||
run crioctl ctr create --config "$TESTDIR"/ctr_by_imageid.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/ctr_by_imageid.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
|
@ -28,22 +28,22 @@ function teardown() {
|
|||
@test "container status return image:tag if created by image ID" {
|
||||
start_crio
|
||||
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
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
|
||||
|
||||
run crioctl ctr create --config "$TESTDIR"/ctr_by_imageid.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/ctr_by_imageid.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id" --output yaml
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Image: redis:alpine" ]]
|
||||
[[ "$output" =~ "image: redis:alpine" ]]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
|
@ -55,22 +55,22 @@ function teardown() {
|
|||
|
||||
start_crio
|
||||
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
sed -e "s/%VALUE%/$REDIS_IMAGEID_DIGESTED/g" "$TESTDATA"/container_config_by_imageid.json > "$TESTDIR"/ctr_by_imageid.json
|
||||
|
||||
run crioctl ctr create --config "$TESTDIR"/ctr_by_imageid.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/ctr_by_imageid.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id" --output yaml
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "ImageRef: redis@sha256:03789f402b2ecfb98184bf128d180f398f81c63364948ff1454583b02442f73b" ]]
|
||||
[[ "$output" =~ "image_ref: redis@sha256:03789f402b2ecfb98184bf128d180f398f81c63364948ff1454583b02442f73b" ]]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
|
@ -79,16 +79,20 @@ function teardown() {
|
|||
|
||||
@test "image pull" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crictl inspecti "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "$IMAGE" ]]
|
||||
cleanup_images
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "image pull with signature" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$SIGNED_IMAGE"
|
||||
run crictl pull "$SIGNED_IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_images
|
||||
|
@ -97,7 +101,7 @@ function teardown() {
|
|||
|
||||
@test "image pull without signature" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$UNSIGNED_IMAGE"
|
||||
run crictl image pull "$UNSIGNED_IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
cleanup_images
|
||||
|
@ -106,26 +110,26 @@ function teardown() {
|
|||
|
||||
@test "image pull and list by digest" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull nginx@sha256:33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
run crictl pull nginx@sha256:33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run crioctl image list --quiet nginx@sha256:33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
run crictl images --quiet nginx@sha256:33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output"
|
||||
[ "$output" != "" ]
|
||||
|
||||
run crioctl image list --quiet nginx@33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
run crictl images --quiet nginx@33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output"
|
||||
[ "$output" != "" ]
|
||||
|
||||
run crioctl image list --quiet @33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
run crictl images --quiet @33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output"
|
||||
[ "$output" != "" ]
|
||||
|
||||
run crioctl image list --quiet 33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
run crictl images --quiet 33eb1ed1e802d4f71e52421f56af028cdf12bb3bfff5affeaf5bf0e328ffa1bc
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output"
|
||||
[ "$output" != "" ]
|
||||
|
@ -136,18 +140,18 @@ function teardown() {
|
|||
|
||||
@test "image list with filter" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl image list --quiet "$IMAGE"
|
||||
run crictl images --quiet "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
printf '%s\n' "$output" | while IFS= read -r id; do
|
||||
run crioctl image remove --id "$id"
|
||||
run crictl rmi "$id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
run crioctl image list --quiet
|
||||
run crictl images --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
printf '%s\n' "$output" | while IFS= read -r id; do
|
||||
|
@ -160,19 +164,19 @@ function teardown() {
|
|||
|
||||
@test "image list/remove" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl image list --quiet
|
||||
run crictl images --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" != "" ]
|
||||
printf '%s\n' "$output" | while IFS= read -r id; do
|
||||
run crioctl image remove --id "$id"
|
||||
run crictl rmi "$id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
run crioctl image list --quiet
|
||||
run crictl images --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "" ]
|
||||
|
@ -186,23 +190,23 @@ function teardown() {
|
|||
|
||||
@test "image status/remove" {
|
||||
start_crio "" "" --no-pause-image
|
||||
run crioctl image pull "$IMAGE"
|
||||
run crictl pull "$IMAGE"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl image list --quiet
|
||||
run crictl images --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" != "" ]
|
||||
printf '%s\n' "$output" | while IFS= read -r id; do
|
||||
run crioctl image status --id "$id"
|
||||
run crictl inspecti "$id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" != "" ]
|
||||
run crioctl image remove --id "$id"
|
||||
run crictl rmi "$id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
run crioctl image list --quiet
|
||||
run crictl images --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "" ]
|
||||
|
|
|
@ -8,28 +8,28 @@ function teardown() {
|
|||
|
||||
@test "image volume ignore" {
|
||||
IMAGE_VOLUMES=ignore start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
image_volume_config=$(cat "$TESTDATA"/container_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["image"]["image"] = "mrunalp/image-volume-test"; obj["command"] = ["/bin/sleep", "600"]; json.dump(obj, sys.stdout)')
|
||||
echo "$image_volume_config" > "$TESTDIR"/container_image_volume.json
|
||||
run crioctl ctr create --config "$TESTDIR"/container_image_volume.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/container_image_volume.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" ls /imagevolume
|
||||
run crictl exec --sync "$ctr_id" ls /imagevolume
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 1" ]]
|
||||
[[ "$output" =~ "ls: /imagevolume: No such file or directory" ]]
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
|
@ -39,27 +39,27 @@ function teardown() {
|
|||
|
||||
@test "image volume bind" {
|
||||
IMAGE_VOLUMES=bind start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
image_volume_config=$(cat "$TESTDATA"/container_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["image"]["image"] = "mrunalp/image-volume-test"; obj["command"] = ["/bin/sleep", "600"]; json.dump(obj, sys.stdout)')
|
||||
echo "$image_volume_config" > "$TESTDIR"/container_image_volume.json
|
||||
run crioctl ctr create --config "$TESTDIR"/container_image_volume.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDIR"/container_image_volume.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr execsync --id "$ctr_id" touch /imagevolume/test_file
|
||||
run crictl exec --sync "$ctr_id" touch /imagevolume/test_file
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 0" ]]
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
|
|
|
@ -12,22 +12,17 @@ function teardown() {
|
|||
echo "$out"
|
||||
[[ "$out" =~ "\"cgroup_driver\":\"$CGROUP_MANAGER\"" ]]
|
||||
[[ "$out" =~ "\"storage_root\":\"$TESTDIR/crio\"" ]]
|
||||
run crioctl info
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "\"cgroup_driver\": \"$CGROUP_MANAGER\"" ]]
|
||||
[[ "$output" =~ "\"storage_root\": \"$TESTDIR/crio\"" ]]
|
||||
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr inspect" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
@ -37,20 +32,22 @@ function teardown() {
|
|||
[[ "$out" =~ "\"sandbox\":\"$pod_id\"" ]]
|
||||
[[ "$out" =~ "\"image\":\"redis:alpine\"" ]]
|
||||
|
||||
run crioctl ctr inspect --id $ctr_id
|
||||
run crictl inspect --output json "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "\"sandbox\": \"$pod_id\"" ]]
|
||||
[[ "$output" =~ "\"id\": \"$ctr_id\"" ]]
|
||||
[[ "$output" =~ "\"image\": \"redis:alpine\"" ]]
|
||||
|
||||
inet=`crioctl ctr execsync --id $ctr_id ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
run crictl inspects --output json "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
inet=`crictl exec --sync "$ctr_id" ip addr show dev eth0 scope global 2>&1 | grep inet`
|
||||
|
||||
IFS=" "
|
||||
ip=`parse_pod_ip $inet`
|
||||
[[ "$out" =~ "\"ip_address\":\"$ip\"" ]]
|
||||
[[ "$out" =~ "\"name\":\"k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1\"" ]]
|
||||
[[ "$output" =~ "\"ip_address\": \"$ip\"" ]]
|
||||
[[ "$output" =~ "\"name\": \"k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1\"" ]]
|
||||
[[ "$output" =~ "\"ip\": \"$ip\"" ]]
|
||||
|
||||
|
||||
# TODO: add some other check based on the json below:
|
||||
|
|
|
@ -13,57 +13,57 @@ function teardown() {
|
|||
|
||||
@test "ensure correct hostname" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "hostname"
|
||||
run crictl exec --sync "$ctr_id" sh -c "hostname"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "crioctl_host" ]]
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "echo \$HOSTNAME"
|
||||
[[ "$output" =~ "crictl_host" ]]
|
||||
run crictl exec --sync "$ctr_id" sh -c "echo \$HOSTNAME"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "crioctl_host" ]]
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "cat /etc/hostname"
|
||||
[[ "$output" =~ "crictl_host" ]]
|
||||
run crictl exec --sync "$ctr_id" sh -c "cat /etc/hostname"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "crioctl_host" ]]
|
||||
[[ "$output" =~ "crictl_host" ]]
|
||||
}
|
||||
|
||||
@test "ensure correct hostname for hostnetwork:true" {
|
||||
start_crio
|
||||
hostnetworkconfig=$(cat "$TESTDATA"/sandbox_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["linux"]["security_context"]["namespace_options"]["host_network"] = True; obj["annotations"] = {}; obj["hostname"] = ""; json.dump(obj, sys.stdout)')
|
||||
echo "$hostnetworkconfig" > "$TESTDIR"/sandbox_hostnetwork_config.json
|
||||
run crioctl pod run --config "$TESTDIR"/sandbox_hostnetwork_config.json
|
||||
run crictl runs "$TESTDIR"/sandbox_hostnetwork_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/sandbox_hostnetwork_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "hostname"
|
||||
run crictl exec --sync "$ctr_id" sh -c "hostname"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "$HOSTNAME" ]]
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "echo \$HOSTNAME"
|
||||
run crictl exec --sync "$ctr_id" sh -c "echo \$HOSTNAME"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "$HOSTNAME" ]]
|
||||
run crioctl ctr execsync --id "$ctr_id" sh -c "cat /etc/hostname"
|
||||
run crictl exec --sync "$ctr_id" sh -c "cat /etc/hostname"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "$HOSTNAME" ]]
|
||||
|
@ -71,27 +71,28 @@ function teardown() {
|
|||
|
||||
@test "Check for valid pod netns CIDR" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
check_pod_cidr $ctr_id
|
||||
|
||||
}
|
||||
|
||||
@test "Ping pod from the host" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
@ -101,22 +102,22 @@ function teardown() {
|
|||
|
||||
@test "Ping pod from another pod" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod1_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod1_id"
|
||||
run crictl create "$pod1_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr1_id="$output"
|
||||
|
||||
temp_sandbox_conf cni_test
|
||||
|
||||
run crioctl pod run --config "$TESTDIR"/sandbox_config_cni_test.json
|
||||
run crictl runs "$TESTDIR"/sandbox_config_cni_test.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod2_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod2_id"
|
||||
run crictl create "$pod2_id" "$TESTDATA"/container_redis.json "$TESTDIR"/sandbox_config_cni_test.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr2_id="$output"
|
||||
|
@ -131,7 +132,7 @@ function teardown() {
|
|||
skip "bridge-custom plugin not available"
|
||||
fi
|
||||
start_crio "" "" "" "prepare_plugin_test_args_network_conf"
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
. /tmp/plugin_test_args.out
|
||||
|
@ -146,7 +147,7 @@ function teardown() {
|
|||
|
||||
@test "Connect to pod hostport from the host" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config_hostport.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config_hostport.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
@ -154,18 +155,18 @@ function teardown() {
|
|||
get_host_ip
|
||||
echo $host_ip
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config_hostport.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config_hostport.json "$TESTDATA"/sandbox_config_hostport.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run nc -w 5 $host_ip 4888 </dev/null
|
||||
echo "$output"
|
||||
[ "$output" = "crioctl_host" ]
|
||||
[ "$output" = "crictl_host" ]
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
run crictl stop "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
@ -179,7 +180,7 @@ function teardown() {
|
|||
# make conmon non-executable to cause the sandbox setup to fail after
|
||||
# networking has been configured
|
||||
chmod 0644 $CONMON_BINARY
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
chmod 0755 $CONMON_BINARY
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
|
|
|
@ -8,69 +8,71 @@ function teardown() {
|
|||
|
||||
@test "crio restore" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl pod list --id "$pod_id"
|
||||
run crictl sandboxes --quiet --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_list_info="$output"
|
||||
|
||||
run crioctl pod status --id "$pod_id"
|
||||
run crictl inspects "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_status_info="$output"
|
||||
pod_status_info=`echo "$output" | grep Status`
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr list --id "$ctr_id"
|
||||
run crictl ps --quiet --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_list_info="$output"
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_status_info="$output"
|
||||
ctr_status_info=`echo "$output" | grep State`
|
||||
|
||||
stop_crio
|
||||
|
||||
start_crio
|
||||
run crioctl pod list
|
||||
run crictl sandboxes --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" != "" ]]
|
||||
[[ "${output}" =~ "${pod_id}" ]]
|
||||
[[ "${output}" == "${pod_id}" ]]
|
||||
|
||||
run crioctl pod list --id "$pod_id"
|
||||
run crictl sandboxes --quiet --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == "${pod_list_info}" ]]
|
||||
|
||||
run crioctl pod status --id "$pod_id"
|
||||
run crictl inspects "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
output=`echo "$output" | grep Status`
|
||||
[[ "${output}" == "${pod_status_info}" ]]
|
||||
|
||||
run crioctl ctr list
|
||||
run crictl ps --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" != "" ]]
|
||||
[[ "${output}" =~ "${ctr_id}" ]]
|
||||
[[ "${output}" == "${ctr_id}" ]]
|
||||
|
||||
run crioctl ctr list --id "$ctr_id"
|
||||
run crictl ps --quiet --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == "${ctr_list_info}" ]]
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
output=`echo "$output" | grep State`
|
||||
[[ "${output}" == "${ctr_status_info}" ]]
|
||||
|
||||
cleanup_ctrs
|
||||
|
@ -80,12 +82,12 @@ function teardown() {
|
|||
|
||||
@test "crio restore with bad state and pod stopped" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -96,7 +98,7 @@ function teardown() {
|
|||
|
||||
start_crio
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -106,17 +108,17 @@ function teardown() {
|
|||
|
||||
@test "crio restore with bad state and ctr stopped" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
run crictl stop "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -127,7 +129,7 @@ function teardown() {
|
|||
|
||||
start_crio
|
||||
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
run crictl stop "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -138,21 +140,21 @@ function teardown() {
|
|||
|
||||
@test "crio restore with bad state and ctr removed" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
run crictl stop "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run crioctl ctr remove --id "$ctr_id"
|
||||
run crictl rm "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -163,7 +165,7 @@ function teardown() {
|
|||
|
||||
start_crio
|
||||
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
run crictl stop "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "${output}" =~ "not found" ]]
|
||||
|
@ -175,16 +177,16 @@ function teardown() {
|
|||
|
||||
@test "crio restore with bad state and pod removed" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -195,7 +197,7 @@ function teardown() {
|
|||
|
||||
start_crio
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -205,22 +207,22 @@ function teardown() {
|
|||
|
||||
@test "crio restore with bad state" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
|
||||
run crioctl pod status --id "$pod_id"
|
||||
run crictl inspects "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" =~ "SANDBOX_READY" ]]
|
||||
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" =~ "CONTAINER_CREATED" ]]
|
||||
|
@ -231,33 +233,34 @@ function teardown() {
|
|||
for i in $("$RUNTIME" list -q | xargs); do "$RUNTIME" delete -f $i; done
|
||||
|
||||
start_crio
|
||||
run crioctl pod list
|
||||
run crictl sandboxes --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" != "" ]]
|
||||
[[ "${output}" =~ "${pod_id}" ]]
|
||||
|
||||
run crioctl pod status --id "$pod_id"
|
||||
run crictl inspects "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" =~ "SANDBOX_NOTREADY" ]]
|
||||
|
||||
run crioctl ctr list
|
||||
run crictl ps --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" != "" ]]
|
||||
[[ "${output}" =~ "${ctr_id}" ]]
|
||||
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
run crictl inspect "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" =~ "CONTAINER_EXITED" ]]
|
||||
[[ "${output}" =~ "Exit Code: 255" ]]
|
||||
# TODO: may be cri-tool should display Exit Code
|
||||
#[[ "${output}" =~ "Exit Code: 255" ]]
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
run crictl stops "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
run crictl rms "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ function teardown() {
|
|||
cleanup_test
|
||||
}
|
||||
|
||||
@test "crioctl runtimeversion" {
|
||||
@test "crictl runtimeversion" {
|
||||
start_crio
|
||||
run crioctl runtimeversion
|
||||
run crictl info
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
stop_crio
|
||||
|
|
|
@ -8,15 +8,15 @@ function teardown() {
|
|||
|
||||
@test "ctr termination reason Completed" {
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config_selinux.json
|
||||
run crictl runs "$TESTDATA"/sandbox_config_selinux.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config_selinux.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
run crictl start "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
|
6
test/testdata/README.md
vendored
6
test/testdata/README.md
vendored
|
@ -5,11 +5,11 @@ sudo ./crio
|
|||
|
||||
In terminal 2:
|
||||
```
|
||||
sudo ./crioctl runtimeversion
|
||||
sudo ./crictl runtimeversion
|
||||
|
||||
sudo rm -rf /var/lib/containers/storage/sandboxes/podsandbox1
|
||||
sudo ./crioctl pod run --config testdata/sandbox_config.json
|
||||
sudo ./crictl runs testdata/sandbox_config.json
|
||||
|
||||
sudo rm -rf /var/lib/containers/storage/containers/container1
|
||||
sudo ./crioctl container create --pod podsandbox1 --config testdata/container_config.json
|
||||
sudo ./crictl create podsandbox1 testdata/container_config.json testdata/sandbox_config.json
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "container1",
|
||||
"name": "test-resolve",
|
||||
"attempt": 1
|
||||
},
|
||||
"image": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "container1",
|
||||
"name": "test-resolve-ro",
|
||||
"attempt": 1
|
||||
},
|
||||
"image": {
|
||||
|
|
2
test/testdata/sandbox1_config.json
vendored
2
test/testdata/sandbox1_config.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/sandbox2_config.json
vendored
2
test/testdata/sandbox2_config.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/sandbox3_config.json
vendored
2
test/testdata/sandbox3_config.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/sandbox_config.json
vendored
2
test/testdata/sandbox_config.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/sandbox_config_hostnet.json
vendored
2
test/testdata/sandbox_config_hostnet.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_options": {
|
||||
"servers": [
|
||||
|
|
2
test/testdata/sandbox_config_hostport.json
vendored
2
test/testdata/sandbox_config_hostport.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_options": {
|
||||
"servers": [
|
||||
|
|
2
test/testdata/sandbox_config_seccomp.json
vendored
2
test/testdata/sandbox_config_seccomp.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_options": {
|
||||
"servers": [
|
||||
|
|
2
test/testdata/sandbox_config_selinux.json
vendored
2
test/testdata/sandbox_config_selinux.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/sandbox_config_sysctl.json
vendored
2
test/testdata/sandbox_config_sysctl.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "redhat.test.crio",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
2
test/testdata/template_sandbox_config.json
vendored
2
test/testdata/template_sandbox_config.json
vendored
|
@ -5,7 +5,7 @@
|
|||
"namespace": "${NAMESPACE}",
|
||||
"attempt": 1
|
||||
},
|
||||
"hostname": "crioctl_host",
|
||||
"hostname": "crictl_host",
|
||||
"log_directory": "",
|
||||
"dns_config": {
|
||||
"searches": [
|
||||
|
|
Loading…
Reference in a new issue