2017-08-12 10:29:22 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
cleanup_test
|
|
|
|
}
|
|
|
|
|
|
|
|
cp hooks/checkhook.sh ${HOOKSDIR}
|
|
|
|
sed "s|HOOKSDIR|${HOOKSDIR}|" hooks/checkhook.json > ${HOOKSDIR}/checkhook.json
|
|
|
|
|
|
|
|
@test "pod test hooks" {
|
2017-09-28 17:46:07 +00:00
|
|
|
rm -f /run/hookscheck
|
2017-08-12 10:29:22 +00:00
|
|
|
start_crio
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl runp "$TESTDATA"/sandbox_config.json
|
2017-08-12 10:29:22 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
pod_id="$output"
|
2017-11-15 15:24:20 +00:00
|
|
|
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
|
2017-08-12 10:29:22 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
ctr_id="$output"
|
2017-11-15 15:24:20 +00:00
|
|
|
run crictl start "$ctr_id"
|
2017-08-12 10:29:22 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl stopp "$pod_id"
|
2017-08-12 10:29:22 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
2018-01-26 02:06:38 +00:00
|
|
|
run crictl rmp "$pod_id"
|
2017-08-12 10:29:22 +00:00
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
run cat /run/hookscheck
|
|
|
|
echo "$output"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
cleanup_ctrs
|
|
|
|
cleanup_pods
|
|
|
|
stop_crio
|
|
|
|
}
|