Rename ocid to crio.
The ocid project was renamed to CRI-O, months ago, it is time that we moved all of the code to the new name. We want to elminate the name ocid from use. Move fully to crio. Also cric is being renamed to crioctl for the time being. Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
81cfba283a
commit
4493b6f176
52 changed files with 677 additions and 677 deletions
286
test/ctr.bats
286
test/ctr.bats
|
@ -7,125 +7,125 @@ function teardown() {
|
|||
}
|
||||
|
||||
@test "ctr remove" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr remove --id "$ctr_id"
|
||||
run crioctl ctr remove --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod stop --id "$pod_id"
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr lifecycle" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic pod list
|
||||
run crioctl pod list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr_id"
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr remove --id "$ctr_id"
|
||||
run crioctl ctr remove --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod stop --id "$pod_id"
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod list
|
||||
run crioctl pod list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod list
|
||||
run crioctl pod list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list
|
||||
run crioctl ctr list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr logging" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic pod list
|
||||
run crioctl pod list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# Create a new container.
|
||||
newconfig=$(mktemp --tmpdir ocid-config.XXXXXX.json)
|
||||
newconfig=$(mktemp --tmpdir crio-config.XXXXXX.json)
|
||||
cp "$TESTDATA"/container_config_logging.json "$newconfig"
|
||||
sed -i 's|"%shellcommand%"|"echo here is some output \&\& echo and some from stderr >\&2"|' "$newconfig"
|
||||
run ocic ctr create --config "$newconfig" --pod "$pod_id"
|
||||
run crioctl ctr create --config "$newconfig" --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr_id"
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
echo "$output"
|
||||
# Ignore errors on stop.
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr remove --id "$ctr_id"
|
||||
run crioctl ctr remove --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -136,46 +136,46 @@ function teardown() {
|
|||
grep -E "^[^\n]+ stdout here is some output$" "$logpath"
|
||||
grep -E "^[^\n]+ stderr and some from stderr$" "$logpath"
|
||||
|
||||
run ocic pod stop --id "$pod_id"
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr logging [tty=true]" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic pod list
|
||||
run crioctl pod list
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# Create a new container.
|
||||
newconfig=$(mktemp --tmpdir ocid-config.XXXXXX.json)
|
||||
newconfig=$(mktemp --tmpdir crio-config.XXXXXX.json)
|
||||
cp "$TESTDATA"/container_config_logging.json "$newconfig"
|
||||
sed -i 's|"%shellcommand%"|"echo here is some output"|' "$newconfig"
|
||||
sed -i 's|"tty": false,|"tty": true,|' "$newconfig"
|
||||
run ocic ctr create --config "$newconfig" --pod "$pod_id"
|
||||
run crioctl ctr create --config "$newconfig" --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr_id"
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
echo "$output"
|
||||
# Ignore errors on stop.
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr remove --id "$ctr_id"
|
||||
run crioctl ctr remove --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
|
@ -185,211 +185,211 @@ function teardown() {
|
|||
echo "$logpath :: $(cat "$logpath")"
|
||||
grep -E "^[^\n]+ stdout here is some output$" "$logpath"
|
||||
|
||||
run ocic pod stop --id "$pod_id"
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
# regression test for #127
|
||||
@test "ctrs status for a pod" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run ocic ctr list --quiet
|
||||
run crioctl ctr list --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" != "" ]]
|
||||
|
||||
printf '%s\n' "$output" | while IFS= read -r id
|
||||
do
|
||||
run ocic ctr status --id "$id"
|
||||
run crioctl ctr status --id "$id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
done
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr list filtering" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json --name pod1
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json --name pod1
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod1_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod1_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod1_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr1_id="$output"
|
||||
run ocic ctr start --id "$ctr1_id"
|
||||
run crioctl ctr start --id "$ctr1_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json --name pod2
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json --name pod2
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod2_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod2_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod2_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr2_id="$output"
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json --name pod3
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json --name pod3
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod3_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod3_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod3_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr3_id="$output"
|
||||
run ocic ctr start --id "$ctr3_id"
|
||||
run crioctl ctr start --id "$ctr3_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr3_id"
|
||||
run crioctl ctr stop --id "$ctr3_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr list --id "$ctr1_id" --quiet
|
||||
run crioctl ctr list --id "$ctr1_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
run ocic ctr list --id "${ctr1_id:0:4}" --quiet
|
||||
run crioctl ctr list --id "${ctr1_id:0:4}" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
run ocic ctr list --id "$ctr2_id" --pod "$pod2_id" --quiet
|
||||
run crioctl ctr list --id "$ctr2_id" --pod "$pod2_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr2_id" ]]
|
||||
run ocic ctr list --id "$ctr2_id" --pod "$pod3_id" --quiet
|
||||
run crioctl ctr list --id "$ctr2_id" --pod "$pod3_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == "" ]]
|
||||
run ocic ctr list --state created --quiet
|
||||
run crioctl ctr list --state created --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr2_id" ]]
|
||||
run ocic ctr list --state running --quiet
|
||||
run crioctl ctr list --state running --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
run ocic ctr list --state stopped --quiet
|
||||
run crioctl ctr list --state stopped --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr3_id" ]]
|
||||
run ocic ctr list --pod "$pod1_id" --quiet
|
||||
run crioctl ctr list --pod "$pod1_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
run ocic ctr list --pod "$pod2_id" --quiet
|
||||
run crioctl ctr list --pod "$pod2_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr2_id" ]]
|
||||
run ocic ctr list --pod "$pod3_id" --quiet
|
||||
run crioctl ctr list --pod "$pod3_id" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr3_id" ]]
|
||||
run ocic pod remove --id "$pod1_id"
|
||||
run crioctl pod remove --id "$pod1_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod2_id"
|
||||
run crioctl pod remove --id "$pod2_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic pod remove --id "$pod3_id"
|
||||
run crioctl pod remove --id "$pod3_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr list label filtering" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr1 --label "a=b" --label "c=d" --label "e=f"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr1 --label "a=b" --label "c=d" --label "e=f"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr1_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr2 --label "a=b" --label "c=d"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr2 --label "a=b" --label "c=d"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr2_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr3 --label "a=b"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id" --name ctr3 --label "a=b"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr3_id="$output"
|
||||
run ocic ctr list --label "tier=backend" --label "a=b" --label "c=d" --label "e=f" --quiet
|
||||
run crioctl ctr list --label "tier=backend" --label "a=b" --label "c=d" --label "e=f" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
run ocic ctr list --label "tier=frontend" --quiet
|
||||
run crioctl ctr list --label "tier=frontend" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == "" ]]
|
||||
run ocic ctr list --label "a=b" --label "c=d" --quiet
|
||||
run crioctl ctr list --label "a=b" --label "c=d" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
[[ "$output" =~ "$ctr2_id" ]]
|
||||
run ocic ctr list --label "a=b" --quiet
|
||||
run crioctl ctr list --label "a=b" --quiet
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" != "" ]]
|
||||
[[ "$output" =~ "$ctr1_id" ]]
|
||||
[[ "$output" =~ "$ctr2_id" ]]
|
||||
[[ "$output" =~ "$ctr3_id" ]]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr metadata in list & status" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
|
||||
run ocic ctr list --id "$ctr_id"
|
||||
run crioctl ctr list --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
# TODO: expected value should not hard coded here
|
||||
[[ "$output" =~ "Name: container1" ]]
|
||||
[[ "$output" =~ "Attempt: 1" ]]
|
||||
|
||||
run ocic ctr status --id "$ctr_id"
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
# TODO: expected value should not hard coded here
|
||||
|
@ -398,161 +398,161 @@ function teardown() {
|
|||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr execsync" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr execsync --id "$ctr_id" echo HELLO
|
||||
run crioctl ctr execsync --id "$ctr_id" echo HELLO
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "HELLO" ]]
|
||||
run ocic ctr execsync --id "$ctr_id" --timeout 1 sleep 10
|
||||
run crioctl ctr execsync --id "$ctr_id" --timeout 1 sleep 10
|
||||
echo "$output"
|
||||
[[ "$output" =~ "command timed out" ]]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr device add" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis_device.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis_device.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr execsync --id "$ctr_id" ls /dev/mynull
|
||||
run crioctl ctr execsync --id "$ctr_id" ls /dev/mynull
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "/dev/mynull" ]]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr execsync failure" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr execsync --id "$ctr_id" doesnotexist
|
||||
run crioctl ctr execsync --id "$ctr_id" doesnotexist
|
||||
echo "$output"
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr execsync exit code" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr execsync --id "$ctr_id" false
|
||||
run crioctl ctr execsync --id "$ctr_id" false
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Exit code: 1" ]]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr execsync std{out,err}" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr execsync --id "$ctr_id" "echo hello0 stdout"
|
||||
run crioctl ctr execsync --id "$ctr_id" "echo hello0 stdout"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"$(printf "Stdout:\nhello0 stdout")"* ]]
|
||||
run ocic ctr execsync --id "$ctr_id" "echo hello1 stderr >&2"
|
||||
run crioctl ctr execsync --id "$ctr_id" "echo hello1 stderr >&2"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"$(printf "Stderr:\nhello1 stderr")"* ]]
|
||||
run ocic ctr execsync --id "$ctr_id" "echo hello2 stderr >&2; echo hello3 stdout"
|
||||
run crioctl ctr execsync --id "$ctr_id" "echo hello2 stderr >&2; echo hello3 stdout"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"$(printf "Stderr:\nhello2 stderr")"* ]]
|
||||
[[ "$output" == *"$(printf "Stdout:\nhello3 stdout")"* ]]
|
||||
run ocic pod remove --id "$pod_id"
|
||||
run crioctl pod remove --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
||||
@test "ctr stop idempotent" {
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
start_crio
|
||||
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
pod_id="$output"
|
||||
run ocic ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
ctr_id="$output"
|
||||
run ocic ctr start --id "$ctr_id"
|
||||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr_id"
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run ocic ctr stop --id "$ctr_id"
|
||||
run crioctl ctr stop --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
cleanup_ctrs
|
||||
cleanup_pods
|
||||
stop_ocid
|
||||
stop_crio
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue