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

36 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bats
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"
# add test-bundle1 as dependency of test-bundle2
add_dependency_to_manifest "$WEB_DIR"/10/Manifest.test-bundle2 test-bundle1
}
@test "REM010: Try removing a bundle that is a dependency of another bundle" {
run sudo sh -c "$SWUPD bundle-remove $SWUPD_OPTS test-bundle1"
assert_status_is "$SWUPD_REQUIRED_BUNDLE_ERROR"
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle1
assert_file_exists "$TARGET_DIR"/usr/share/clear/bundles/test-bundle2
assert_file_exists "$TARGET_DIR"/foo/test-file1
assert_file_exists "$TARGET_DIR"/bar/test-file2
expected_output=$(cat <<-EOM
Bundle "test-bundle1" is required by the following bundles:
- test-bundle2
Error: Bundle "test-bundle1" is required by 1 bundle, skipping it...
Use "swupd bundle-remove --force test-bundle1" to remove "test-bundle1" and all bundles that require it
Failed to remove 1 of 1 bundles
EOM
)
assert_is_output "$expected_output"
}
#WEIGHT=3