2016-09-27 07:14:31 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
cleanup_test
|
|
|
|
}
|
|
|
|
|
|
|
|
# PR#59
|
|
|
|
@test "pod release name on remove" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-09-27 08:40:33 +00:00
|
|
|
echo "$output"
|
2016-10-02 08:13:00 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2016-09-27 07:14:31 +00:00
|
|
|
id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$id"
|
2016-10-02 08:13:00 +00:00
|
|
|
echo "$output"
|
2016-09-27 07:14:31 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$id"
|
2016-10-02 08:13:00 +00:00
|
|
|
echo "$output"
|
2016-09-27 07:14:31 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-09-27 18:36:17 +00:00
|
|
|
echo "$output"
|
2016-10-02 08:13:00 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2016-09-27 18:36:17 +00:00
|
|
|
id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$id"
|
2016-10-02 08:13:00 +00:00
|
|
|
echo "$output"
|
2016-09-27 18:36:17 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$id"
|
2016-10-02 08:13:00 +00:00
|
|
|
echo "$output"
|
2016-09-27 18:36:17 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2016-10-08 12:57:45 +00:00
|
|
|
cleanup_ctrs
|
2016-09-27 08:54:16 +00:00
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-09-27 07:14:31 +00:00
|
|
|
}
|
2016-09-28 20:15:57 +00:00
|
|
|
|
|
|
|
@test "pod remove" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-09-28 20:15:57 +00:00
|
|
|
echo "$output"
|
2016-10-02 08:13:00 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2016-09-28 20:15:57 +00:00
|
|
|
pod_id="$output"
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
2016-09-28 20:15:57 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
ctr_id="$output"
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl start "$ctr_id"
|
2016-09-28 20:15:57 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2017-05-21 13:47:01 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod_id"
|
2016-09-28 20:15:57 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2016-10-08 12:57:45 +00:00
|
|
|
cleanup_ctrs
|
2016-09-28 20:15:57 +00:00
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-09-28 20:15:57 +00:00
|
|
|
}
|
2016-10-17 19:51:21 +00:00
|
|
|
|
2017-05-20 13:14:51 +00:00
|
|
|
@test "pod stop ignores not found sandboxes" {
|
|
|
|
start_crio
|
|
|
|
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2017-05-20 13:14:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2017-05-20 13:14:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod_id"
|
2017-05-20 13:14:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2017-05-20 13:14:51 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
|
|
|
stop_crio
|
|
|
|
}
|
|
|
|
|
2016-10-17 19:51:21 +00:00
|
|
|
@test "pod list filtering" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox1_config.json
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod1_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox2_config.json
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod2_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox3_config.json
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod3_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --label "name=podsandbox3" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
#[[ "$output" != "" ]]
|
|
|
|
[[ "$output" == "$pod3_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --label "label=not-exist" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" == "" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --label "group=test" --label "version=v1.0.0" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" != "" ]]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" =~ "$pod1_id" ]]
|
|
|
|
[[ "$output" =~ "$pod2_id" ]]
|
|
|
|
[[ "$output" != "$pod3_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --label "group=test" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" != "" ]]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" =~ "$pod1_id" ]]
|
|
|
|
[[ "$output" =~ "$pod2_id" ]]
|
|
|
|
[[ "$output" =~ "$pod3_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod1_id" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod1_id" ]]
|
2016-12-06 11:12:52 +00:00
|
|
|
# filter by truncated id should work as well
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "${pod1_id:0:4}" --quiet
|
2016-12-06 11:12:52 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod1_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod2_id" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod2_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod3_id" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod3_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod1_id" --label "group=test" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod1_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod2_id" --label "group=test" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod2_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod3_id" --label "group=test" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
[[ "$output" == "$pod3_id" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod3_id" --label "group=production" --quiet
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" == "" ]]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod1_id"
|
2017-05-21 13:47:01 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod1_id"
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod2_id"
|
2017-05-21 13:47:01 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod2_id"
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod3_id"
|
2017-05-21 13:47:01 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod3_id"
|
2016-10-17 19:51:21 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-10-27 06:24:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "pod metadata in list & status" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-10-27 06:24:27 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
|
|
|
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl pods --id "$pod_id" --verbose
|
2016-10-27 06:24:27 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
# TODO: expected value should not hard coded here
|
|
|
|
[[ "$output" =~ "Name: podsandbox1" ]]
|
2017-05-12 13:36:15 +00:00
|
|
|
[[ "$output" =~ "UID: redhat-test-crio" ]]
|
|
|
|
[[ "$output" =~ "Namespace: redhat.test.crio" ]]
|
2016-10-27 06:24:27 +00:00
|
|
|
[[ "$output" =~ "Attempt: 1" ]]
|
|
|
|
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl inspectp "$pod_id" --output table
|
2016-10-27 06:24:27 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
# TODO: expected value should not hard coded here
|
|
|
|
[[ "$output" =~ "Name: podsandbox1" ]]
|
2017-05-12 13:36:15 +00:00
|
|
|
[[ "$output" =~ "UID: redhat-test-crio" ]]
|
|
|
|
[[ "$output" =~ "Namespace: redhat.test.crio" ]]
|
2016-10-27 06:24:27 +00:00
|
|
|
[[ "$output" =~ "Attempt: 1" ]]
|
|
|
|
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-10-27 06:24:27 +00:00
|
|
|
}
|
2016-11-19 02:17:14 +00:00
|
|
|
|
|
|
|
@test "pass pod sysctls to runtime" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config_sysctl.json
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
|
|
|
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config_sysctl.json
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2017-11-15 08:09:08 +00:00
|
|
|
ctr_id="$output"
|
2016-11-19 02:17:14 +00:00
|
|
|
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl start "$ctr_id"
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl exec --sync "$ctr_id" sysctl kernel.shm_rmid_forced
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" =~ "kernel.shm_rmid_forced = 1" ]]
|
|
|
|
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl exec --sync "$ctr_id" sysctl kernel.msgmax
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" =~ "kernel.msgmax = 8192" ]]
|
|
|
|
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl exec --sync "$ctr_id" sysctl net.ipv4.ip_local_port_range
|
2016-11-19 02:17:14 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" =~ "net.ipv4.ip_local_port_range = 1024 65000" ]]
|
|
|
|
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-11-19 02:17:14 +00:00
|
|
|
}
|
2016-12-06 11:39:38 +00:00
|
|
|
|
|
|
|
@test "pod stop idempotent" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-06 11:39:38 +00:00
|
|
|
}
|
|
|
|
|
2016-12-08 23:43:25 +00:00
|
|
|
@test "pod remove idempotent" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-12-08 23:43:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2017-05-21 13:47:01 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod_id"
|
2016-12-08 23:43:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod_id"
|
2016-12-08 23:43:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-08 23:43:25 +00:00
|
|
|
}
|
|
|
|
|
2016-12-06 11:39:38 +00:00
|
|
|
@test "pod stop idempotent with ctrs already stopped" {
|
2017-05-12 13:36:15 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl create "$pod_id" "$TESTDATA"/container_config.json "$TESTDATA"/sandbox_config.json
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
ctr_id="$output"
|
2017-11-15 08:09:08 +00:00
|
|
|
run crictl start "$ctr_id"
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
run crictl stop "$ctr_id"
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2016-12-06 11:39:38 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-06 11:39:38 +00:00
|
|
|
}
|
2016-12-09 10:56:25 +00:00
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
@test "restart crio and still get pod status" {
|
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2016-12-09 10:56:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2016-12-09 10:56:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
2017-05-12 13:36:15 +00:00
|
|
|
restart_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl inspectp "$pod_id"
|
2016-12-09 10:56:25 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" != "" ]
|
|
|
|
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
2017-05-12 13:36:15 +00:00
|
|
|
stop_crio
|
2016-12-09 10:56:25 +00:00
|
|
|
}
|
2017-05-18 16:23:16 +00:00
|
|
|
|
|
|
|
@test "invalid systemd cgroup_parent fail" {
|
|
|
|
if [[ "$CGROUP_MANAGER" != "systemd" ]]; then
|
|
|
|
skip "need systemd cgroup manager"
|
|
|
|
fi
|
|
|
|
|
|
|
|
wrong_cgroup_parent_config=$(cat "$TESTDATA"/sandbox_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["linux"]["cgroup_parent"] = "podsandbox1.slice:container:infra"; json.dump(obj, sys.stdout)')
|
|
|
|
echo "$wrong_cgroup_parent_config" > "$TESTDIR"/sandbox_wrong_cgroup_parent.json
|
|
|
|
|
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDIR"/sandbox_wrong_cgroup_parent.json
|
2017-05-18 16:23:16 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
|
|
|
|
stop_crio
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "systemd cgroup_parent correctly set" {
|
|
|
|
if [[ "$CGROUP_MANAGER" != "systemd" ]]; then
|
|
|
|
skip "need systemd cgroup manager"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cgroup_parent_config=$(cat "$TESTDATA"/sandbox_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["linux"]["cgroup_parent"] = "/Burstable/pod_integration_tests-123"; json.dump(obj, sys.stdout)')
|
|
|
|
echo "$cgroup_parent_config" > "$TESTDIR"/sandbox_systemd_cgroup_parent.json
|
|
|
|
|
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDIR"/sandbox_systemd_cgroup_parent.json
|
2017-05-18 16:23:16 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
|
|
|
|
|
|
|
run systemctl list-units --type=slice
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ "$output" =~ "Burstable-pod_integration_tests_123.slice" ]]
|
|
|
|
|
|
|
|
cleanup_pods
|
|
|
|
stop_crio
|
|
|
|
}
|