mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-03 12:11:28 +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>
48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 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"
|
|
create_bundle -L -n test-bundle1 -f /foo/test-file1 "$TEST_NAME"
|
|
create_bundle -L -n test-bundle2 -f /bar/test-file2 "$TEST_NAME"
|
|
create_bundle -L -n test-bundle3 -f /baz/test-file3 "$TEST_NAME"
|
|
|
|
# add test-bundle2 as a dependency of test-bundle1 and
|
|
# test-bundle3 as optional
|
|
add_dependency_to_manifest "$WEB_DIR"/10/Manifest.test-bundle1 test-bundle2
|
|
add_dependency_to_manifest -o "$WEB_DIR"/10/Manifest.test-bundle1 test-bundle3
|
|
|
|
}
|
|
|
|
@test "REM021: Removing an optional bundle" {
|
|
|
|
# An optional bundle is not required to be installed in the system while includes
|
|
# are, but they are installed by default. Users shuld be able to remove them.
|
|
|
|
run sudo sh -c "$SWUPD bundle-remove $SWUPD_OPTS test-bundle3"
|
|
|
|
assert_status_is 0
|
|
expected_output=$(cat <<-EOM
|
|
The following bundles are being removed:
|
|
- test-bundle3
|
|
Deleting bundle files...
|
|
Total deleted files: 3
|
|
Successfully removed 1 bundle
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
assert_file_exists "$TARGET_DIR"/foo/test-file1
|
|
assert_file_exists "$TARGET_DIR"/bar/test-file2
|
|
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle1
|
|
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle2
|
|
assert_file_not_exists "$TARGET_DIR"/baz/test-file3
|
|
assert_file_not_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle3
|
|
|
|
}
|
|
#WEIGHT=4
|