Skip to content

Commit

Permalink
test/system: Don't assume that no container will have /etc/kernel
Browse files Browse the repository at this point in the history
Any image or container that has APT or systemd may have /etc/kernel.
eg., the arch-toolbox and ubuntu-toolbox images.

#1409

Signed-off-by: Penn Bauman <[email protected]>
  • Loading branch information
pennbauman authored and debarshiray committed Dec 7, 2023
1 parent 25391e7 commit 2f3ee0e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/system/104-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,21 @@ teardown() {

create_default_container

pushd /etc/kernel
local host_only_dir
host_only_dir="$(mktemp --directory /var/tmp/toolbox-test-XXXXXXXXXX)"

pushd "$host_only_dir"
run --separate-stderr "$TOOLBOX" run pwd
popd

rm --force --recursive "$host_only_dir"

assert_success
assert_line --index 0 "$HOME"
assert [ ${#lines[@]} -eq 1 ]
lines=("${stderr_lines[@]}")
assert_line --index $((${#stderr_lines[@]}-2)) "Error: directory /etc/kernel not found in container $default_container_name"
assert_line --index $((${#stderr_lines[@]}-2)) \
"Error: directory $host_only_dir not found in container $default_container_name"
assert_line --index $((${#stderr_lines[@]}-1)) "Using $HOME instead."
assert [ ${#stderr_lines[@]} -gt 2 ]
}
Expand Down

0 comments on commit 2f3ee0e

Please sign in to comment.