mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-04 04:31:35 +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>
109 lines
3.9 KiB
Bash
Executable File
109 lines
3.9 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"
|
|
create_bundle -n test-bundle1 -f /file_1,/file_2 "$TEST_NAME"
|
|
create_bundle -n test-bundle2 -f /foo/file_3 "$TEST_NAME"
|
|
create_bundle -n test-bundle3 -f /bar/file_4 "$TEST_NAME"
|
|
# os-core is always included by all manifests
|
|
add_dependency_to_manifest "$WEB_DIR"/10/Manifest.test-bundle1 os-core
|
|
add_dependency_to_manifest "$WEB_DIR"/10/Manifest.test-bundle2 os-core
|
|
add_dependency_to_manifest "$WEB_DIR"/10/Manifest.test-bundle3 os-core
|
|
|
|
}
|
|
|
|
@test "INS004: An OS install can include user specified bundles during OS install" {
|
|
|
|
# users can specify bundles to be added to the OS during install,
|
|
# os-core does not need to be specified, it will be installed by default
|
|
|
|
run sudo sh -c "$SWUPD os-install $SWUPD_OPTS --bundles test-bundle2,test-bundle3"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
Installing OS version 10 (latest)
|
|
Downloading missing manifests...
|
|
Downloading packs for:
|
|
- os-core
|
|
- test-bundle2
|
|
- test-bundle3
|
|
Finishing packs extraction...
|
|
Checking for corrupt files
|
|
Validate downloaded files
|
|
No extra files need to be downloaded
|
|
Installing base OS and selected bundles
|
|
Inspected 8 files
|
|
8 files were missing
|
|
8 of 8 missing files were installed
|
|
0 of 8 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"/usr/share/clear/bundles/test-bundle2
|
|
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle3
|
|
assert_file_exists "$TARGET_DIR"/core
|
|
assert_file_exists "$TARGET_DIR"/foo/file_3
|
|
assert_file_exists "$TARGET_DIR"/bar/file_4
|
|
assert_file_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle2
|
|
assert_file_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle3
|
|
# make sure non specified bundles were not installed
|
|
assert_file_not_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle1
|
|
assert_file_not_exists "$TARGET_DIR"/file_1
|
|
assert_file_not_exists "$TARGET_DIR"/file_2
|
|
assert_file_not_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle1
|
|
assert_file_not_exists "$TARGET_DIR"/var/lib/swupd/bundles/os-core
|
|
|
|
}
|
|
|
|
@test "INS026: An OS install with user specified bundles that include os-core works correctly" {
|
|
|
|
run sudo sh -c "$SWUPD os-install $SWUPD_OPTS --bundles test-bundle2,os-core"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
Installing OS version 10 (latest)
|
|
Downloading missing manifests...
|
|
Downloading packs for:
|
|
- test-bundle2
|
|
- 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 5 files
|
|
5 files were missing
|
|
5 of 5 missing files were installed
|
|
0 of 5 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"/usr/share/clear/bundles/test-bundle2
|
|
assert_file_exists "$TARGET_DIR"/core
|
|
assert_file_exists "$TARGET_DIR"/foo/file_3
|
|
assert_file_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle2
|
|
assert_file_exists "$TARGET_DIR"/var/lib/swupd/bundles/os-core
|
|
# make sure non specified bundles were not installed
|
|
assert_file_not_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle1
|
|
assert_file_not_exists "$TARGET_DIR"/file_1
|
|
assert_file_not_exists "$TARGET_DIR"/file_2
|
|
assert_file_not_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle1
|
|
assert_file_not_exists "$TARGET_DIR"/var/lib/swupd/bundles/test-bundle3
|
|
assert_file_not_exists "$TARGET_DIR"/bar/file_4
|
|
|
|
}
|
|
#WEIGHT=9
|