seccomp: Add test using the seccomp agent example

This commit adds the config.json as generated by the script. Note that
the diff is minimal if you see this commit with "git show -w". The
differences are mostly whitespaces and some ordering.

We add a simple test that runs this and expects sucess.

Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
This commit is contained in:
Rodrigo Campos
2021-09-09 17:06:23 +02:00
parent 51cd519e4c
commit af641cd587
4 changed files with 54 additions and 201 deletions
+16
View File
@@ -198,3 +198,19 @@ function scmp_act_notify_template() {
runc run test_busybox
[ "$status" -eq 0 ]
}
# Check that example config in the seccomp agent dir works.
@test "runc run [seccomp] (SCMP_ACT_NOTIFY example config)" {
# Run the script used in the seccomp agent example.
# This takes a bare config.json and modifies it to run an example.
"${INTEGRATION_ROOT}/../../contrib/cmd/seccompagent/gen-seccomp-example-cfg.sh"
# The listenerPath the previous command uses is the default used by the
# seccomp agent. However, inside bats the socket is in a bats tmp dir.
update_config '.linux.seccomp.listenerPath = "'"$SECCCOMP_AGENT_SOCKET"'"'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "$output" == *"chmod:"*"test-file"*"No medium found"* ]]
}