Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 7f59817

Browse files
William Douglasbryteise
authored andcommitted
Improve tests for container
Detect docker container usage when running test to handle cases where systemd is unlikely to be running. Signed-off-by: William Douglas <[email protected]>
1 parent 776f8c9 commit 7f59817

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/functional/api/api-autoupdate.bats

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ test_setup() {
4141

4242
run sudo sh -c "$SWUPD autoupdate $SWUPD_OPTS --disable --quiet"
4343

44-
assert_status_is "$SWUPD_OK"
44+
if [ "$(systemd-detect-virt)" = "docker" ] ; then
45+
assert_status_is "$SWUPD_SUBPROCESS_ERROR"
46+
else
47+
assert_status_is "$SWUPD_OK"
48+
fi
4549
assert_output_is_empty
4650
# check mask files don't exist
4751
assert_symlink_exists "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.service

test/functional/autoupdate/aup-basic.bats

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ test_setup() {
1515

1616
# perform autoupdate disable
1717
run sudo sh -c "$SWUPD autoupdate --disable $SWUPD_OPTS"
18-
assert_status_is "$SWUPD_OK"
18+
if [ "$(systemd-detect-virt)" = "docker" ] ; then
19+
assert_status_is "$SWUPD_SUBPROCESS_ERROR"
20+
else
21+
assert_status_is "$SWUPD_OK"
22+
fi
1923
expected_output=$(cat <<-EOM
2024
Warning: disabling automatic updates may take you out of compliance with your IT policy
2125
Running systemctl to disable updates

0 commit comments

Comments
 (0)