mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 14:13:58 +08:00
7d1df7b66b
Those are no longer needed with shellcheck v0.10.0 (possibly with an
earlier version, too, but I am too lazy to check that).
While at it, fix a typo in the comment.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit af386d1df1)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
43 lines
1.2 KiB
Bash
43 lines
1.2 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
function setup() {
|
|
setup_busybox
|
|
}
|
|
|
|
function teardown() {
|
|
teardown_bundle
|
|
}
|
|
|
|
@test "runc create [second createRuntime hook fails]" {
|
|
update_config '.hooks |= {"createRuntime": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
|
|
|
|
runc create --console-socket "$CONSOLE_SOCKET" test_hooks
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"error running createRuntime hook #1:"* ]]
|
|
}
|
|
|
|
@test "runc create [hook fails]" {
|
|
for hook in prestart createRuntime createContainer; do
|
|
echo "testing hook $hook"
|
|
update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
|
|
runc create --console-socket "$CONSOLE_SOCKET" test_hooks
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"error running $hook hook #1:"* ]]
|
|
done
|
|
}
|
|
|
|
@test "runc run [hook fails]" {
|
|
update_config '.process.args = ["/bin/echo", "Hello World"]'
|
|
# All hooks except Poststop.
|
|
for hook in prestart createRuntime createContainer startContainer poststart; do
|
|
echo "testing hook $hook"
|
|
update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
|
|
runc run "test_hook-$hook"
|
|
[[ "$output" != "Hello World" ]]
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"error running $hook hook #1:"* ]]
|
|
done
|
|
}
|