2017-11-10 03:24:34 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
cleanup_test
|
|
|
|
}
|
|
|
|
|
2018-01-20 23:43:18 +00:00
|
|
|
function pid_namespace_test() {
|
|
|
|
start_crio
|
2017-11-10 03:24:34 +00:00
|
|
|
|
|
|
|
run crictl runs "$TESTDATA"/sandbox_config.json
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
|
|
|
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
ctr_id="$output"
|
|
|
|
run crictl start "$ctr_id"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
run crictl exec --sync "$ctr_id" cat /proc/1/cmdline
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-20 23:43:18 +00:00
|
|
|
[[ "$output" =~ "${EXPECTED_INIT:-redis}" ]]
|
2017-11-10 03:24:34 +00:00
|
|
|
|
|
|
|
run crictl stops "$pod_id"
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
run crictl rms "$pod_id"
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
|
|
|
stop_crio
|
|
|
|
}
|
|
|
|
|
2018-01-20 23:43:18 +00:00
|
|
|
@test "pod disable shared pid namespace" {
|
|
|
|
ENABLE_SHARED_PID_NAMESPACE=false pid_namespace_test
|
|
|
|
}
|
2017-11-10 03:24:34 +00:00
|
|
|
|
2018-01-20 23:43:18 +00:00
|
|
|
@test "pod enable shared pid namespace" {
|
|
|
|
ENABLE_SHARED_PID_NAMESPACE=true EXPECTED_INIT=pause pid_namespace_test
|
2017-11-10 03:24:34 +00:00
|
|
|
}
|