mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-06 05:32:01 +00:00
Environment variables are used everywhere in testilb. This environment variables are global variables that define the way testlib behaves. However is was confusing to use the variables because they were inconsistent between each other, for example some variables that define paths would have absolute paths while other would have relative paths, making it error prone while using them. This commit makes the environment variables more consistent by following a name convention for each type of variable, as an example, variables that define absolute paths follow this convention ABS_<path_name>_DIR, while variables that define relative paths are defined like this <path_name>_DIR. Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
62 lines
1.3 KiB
Bash
Executable File
62 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
|
|
load "../testlib"
|
|
|
|
test_setup() {
|
|
|
|
create_test_environment "$TEST_NAME" 10
|
|
|
|
}
|
|
|
|
@test "UPD019: Try updating a system where the server is older than the target system" {
|
|
|
|
set_current_version "$TEST_NAME" 20
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS"
|
|
|
|
assert_status_is 0
|
|
expected_output=$(cat <<-EOM
|
|
Update started
|
|
Version on server (10) is not newer than system version (20)
|
|
Update complete - System already up-to-date at version 20
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "UPD020: Try updating a system where there is no server version file available" {
|
|
|
|
sudo rm -rf "$WEB_DIR"/version
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS"
|
|
|
|
assert_status_is "$SWUPD_SERVER_CONNECTION_ERROR"
|
|
expected_output=$(cat <<-EOM
|
|
Error: Unable to determine the server version
|
|
Update failed
|
|
EOM
|
|
)
|
|
assert_in_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "UPD021: Try updating a system where there is no target version file available" {
|
|
|
|
sudo rm -rf "$TARGET_DIR"/usr/lib/os-release
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS"
|
|
|
|
assert_status_is "$SWUPD_CURRENT_VERSION_UNKNOWN"
|
|
expected_output=$(cat <<-EOM
|
|
Update started
|
|
Error: Unable to determine current OS version
|
|
Warning: Unable to determine current OS version
|
|
Update failed
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
#WEIGHT=3
|