Files
Castulo Martinez 7dd6fc221a Testlib: renaming variables for consistency
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>
2020-06-16 11:42:13 -07:00

116 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bats
# Author: Castulo Martinez
# Email: castulo.martinez@intel.com
load "../testlib"
test_setup() {
create_test_environment -e "$TEST_NAME" 10
create_bundle -n os-core -f /core "$TEST_NAME"
# version 20
create_version "$TEST_NAME" 20 10
update_bundle "$TEST_NAME" os-core --update /core
# version 30
create_version "$TEST_NAME" 30 20
update_bundle "$TEST_NAME" os-core --add-dir /some_dir
}
@test "INS005: An OS install defaults to the latest OS version" {
# if no version is specified when installing, it defaults to the latest
run sudo sh -c "$SWUPD os-install $SWUPD_OPTS"
assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Installing OS version 30 (latest)
Downloading missing manifests...
Downloading packs for:
- os-core
Finishing packs extraction...
Checking for corrupt files
Validate downloaded files
No extra files need to be downloaded
Installing base OS and selected bundles
Inspected 3 files
3 files were missing
3 of 3 missing files were installed
0 of 3 missing files were not installed
Calling post-update helper scripts
Installation successful
EOM
)
assert_is_output "$expected_output"
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/os-core
assert_file_exists "$TARGET_DIR"/core
assert_dir_exists "$TARGET_DIR"/some_dir
}
@test "INS006: User can specify latest OS version when installing" {
# users can specify the "latest" version
run sudo sh -c "$SWUPD os-install $SWUPD_OPTS -V latest"
assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Installing OS version 30 (latest)
Downloading missing manifests...
Downloading packs for:
- os-core
Finishing packs extraction...
Checking for corrupt files
Validate downloaded files
No extra files need to be downloaded
Installing base OS and selected bundles
Inspected 3 files
3 files were missing
3 of 3 missing files were installed
0 of 3 missing files were not installed
Calling post-update helper scripts
Installation successful
EOM
)
assert_is_output "$expected_output"
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/os-core
assert_file_exists "$TARGET_DIR"/core
assert_dir_exists "$TARGET_DIR"/some_dir
}
@test "INS007: User can specify the OS version to install" {
# users can specify the version to install
run sudo sh -c "$SWUPD os-install $SWUPD_OPTS -V 20"
assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Installing OS version 20
Downloading missing manifests...
Downloading packs for:
- os-core
Finishing packs extraction...
Checking for corrupt files
Validate downloaded files
No extra files need to be downloaded
Installing base OS and selected bundles
Inspected 2 files
2 files were missing
2 of 2 missing files were installed
0 of 2 missing files were not installed
Calling post-update helper scripts
Installation successful
EOM
)
assert_is_output "$expected_output"
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/os-core
assert_file_exists "$TARGET_DIR"/core
}
#WEIGHT=8