mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-03 04:01:34 +00:00
systemctl reports that the timer file is missing now as a return code 4 so update the unknown start number. Also with this change SWUPD_NO is no longer always returned so add a new helper to check if a status is one of multiple options. Signed-off-by: William Douglas <william.douglas@intel.com>
57 lines
1.4 KiB
Bash
Executable File
57 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
|
|
# Author: Castulo Martinez
|
|
# Email: castulo.martinez@intel.com
|
|
|
|
load "../testlib"
|
|
|
|
test_setup() {
|
|
|
|
create_test_environment "$TEST_NAME"
|
|
sudo mkdir -p "$ABS_TARGET_DIR"/etc/systemd/system
|
|
|
|
}
|
|
|
|
@test "API004: autoupdate" {
|
|
|
|
run sudo sh -c "$SWUPD autoupdate $SWUPD_OPTS --quiet"
|
|
|
|
assert_status_in "$SWUPD_NO" "$SWUPD_SUBPROCESS_ERROR"
|
|
assert_output_is_empty
|
|
|
|
}
|
|
|
|
@test "API005: autoupdate --enable" {
|
|
|
|
# create mask files manually
|
|
sudo ln -s /dev/null "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.service
|
|
sudo ln -s /dev/null "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.timer
|
|
|
|
run sudo sh -c "$SWUPD autoupdate $SWUPD_OPTS --enable --quiet"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
assert_output_is_empty
|
|
# check mask files don't exist
|
|
assert_file_not_exists "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.service
|
|
assert_file_not_exists "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.timer
|
|
|
|
}
|
|
|
|
@test "API006: autoupdate --disable" {
|
|
|
|
run sudo sh -c "$SWUPD autoupdate $SWUPD_OPTS --disable --quiet"
|
|
|
|
if [ "$(systemd-detect-virt)" = "docker" ] ; then
|
|
assert_status_is "$SWUPD_SUBPROCESS_ERROR"
|
|
else
|
|
assert_status_is "$SWUPD_OK"
|
|
fi
|
|
assert_output_is_empty
|
|
# check mask files don't exist
|
|
assert_symlink_exists "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.service
|
|
assert_symlink_exists "$ABS_TARGET_DIR"/etc/systemd/system/swupd-update.timer
|
|
|
|
}
|
|
|
|
#WEIGHT=3
|