Files
Kir Kolyshkin 07cd18c9c9 tests/int: use assert for substring and regexp comparisons
The point of the assert helpers is that a failed test says what it
wanted and what it got, so leaving most comparisons as bare [[ ]]
defeats it.

Convert the rest of the checks on $output and $lines. Those using a glob
to look for a substring become --partial, the rest become --regexp (the
patterns are translated to extended regular expressions, and anchored
where the glob was).

The few remaining [[ ]] are not assertions: one is an if condition, and
another one is the left hand side of ||, offering an alternative to the
assert that follows it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-10-02 14:47:43 -07:00

19 lines
395 B
Bash

#!/usr/bin/env bats
load helpers
function setup() {
requires root apparmor
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "runc run [unloaded apparmor profile]" {
update_config ' .process.apparmorProfile = "runc-test-definitely-not-loaded"'
run ! runc run test_apparmor
assert_output --regexp 'apparmor profile .*runc-test-definitely-not-loaded.*profile not loaded'
}