test/namespaces: Factor out pid_namespace_test helper
DRY up this code. The ${parameter:-word} syntax is in POSIX [1]. [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 Signed-off-by: W. Trevor King <wking@tremily.us>
This commit is contained in:
parent
214096b7ed
commit
080b84dfcd
1 changed files with 8 additions and 30 deletions
|
@ -6,8 +6,8 @@ function teardown() {
|
||||||
cleanup_test
|
cleanup_test
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "pod disable shared pid namespace" {
|
function pid_namespace_test() {
|
||||||
ENABLE_SHARED_PID_NAMESPACE="false" start_crio
|
start_crio
|
||||||
|
|
||||||
run crictl runs "$TESTDATA"/sandbox_config.json
|
run crictl runs "$TESTDATA"/sandbox_config.json
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
@ -23,7 +23,7 @@ function teardown() {
|
||||||
run crictl exec --sync "$ctr_id" cat /proc/1/cmdline
|
run crictl exec --sync "$ctr_id" cat /proc/1/cmdline
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" =~ "redis" ]]
|
[[ "$output" =~ "${EXPECTED_INIT:-redis}" ]]
|
||||||
|
|
||||||
run crictl stops "$pod_id"
|
run crictl stops "$pod_id"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
@ -36,32 +36,10 @@ function teardown() {
|
||||||
stop_crio
|
stop_crio
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "pod disable shared pid namespace" {
|
||||||
|
ENABLE_SHARED_PID_NAMESPACE=false pid_namespace_test
|
||||||
|
}
|
||||||
|
|
||||||
@test "pod enable shared pid namespace" {
|
@test "pod enable shared pid namespace" {
|
||||||
ENABLE_SHARED_PID_NAMESPACE="true" start_crio
|
ENABLE_SHARED_PID_NAMESPACE=true EXPECTED_INIT=pause pid_namespace_test
|
||||||
|
|
||||||
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 ]
|
|
||||||
[[ "$output" =~ "pause" ]]
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue