Show the real latest version using check-update

When running the check-update command we get the latest version for the
format we are currently in, but we really want to get the latest version
regardless of the format.

This commit fixes the issue.

Closes #482

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
Castulo Martinez
2019-08-14 14:31:33 -07:00
committed by Otavio Pontes
parent f19e8dce06
commit a41bea9fd5
9 changed files with 89 additions and 30 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bats
# Author: Castulo Martinez
# Email: castulo.martinez@intel.com
load "../testlib"
test_setup() {
create_test_environment -r "$TEST_NAME" 10 1
bump_format "$TEST_NAME"
create_version -r "$TEST_NAME" 40 30 2
}
@test "CHK010: Check for available updates accross format bumps" {
# check-update should return the latest available version regardless
# of if it is in a different format
run sudo sh -c "$SWUPD check-update $SWUPD_OPTS"
assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Current OS version: 10
Latest server version: 40
There is a new OS version available: 40
EOM
)
assert_is_output "$expected_output"
}
+1
View File
@@ -1356,6 +1356,7 @@ create_version() { # swupd_function
sudo mkdir -p "$env_name"/web-dir/"$version"/{files,delta}
sudo mkdir -p "$env_name"/web-dir/version/format"$format"
write_to_protected_file "$env_name"/web-dir/version/format"$format"/latest "$version"
write_to_protected_file "$env_name"/web-dir/version/latest_version "$version"
if [ "$format" = staging ]; then
format=1
fi
@@ -5,7 +5,7 @@ load "../testlib"
test_setup() {
create_test_environment -e "$TEST_NAME"
set_latest_version "$TEST_NAME" 100
create_version "$TEST_NAME" 100
sudo rm -f "$TARGETDIR"/usr/lib/os-release
}
+1 -1
View File
@@ -5,7 +5,7 @@ load "../testlib"
global_setup() {
create_test_environment -e "$TEST_NAME"
set_latest_version "$TEST_NAME" 100
create_version "$TEST_NAME" 100
}