mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-06 05:32:01 +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>
44 lines
1.4 KiB
Bash
Executable File
44 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
|
|
load "../testlib"
|
|
|
|
test_setup() {
|
|
|
|
create_test_environment "$TEST_NAME"
|
|
create_bundle -n test-bundle1 -f /foo/bar/test-file1 "$TEST_NAME"
|
|
create_bundle -L -n test-bundle2 -d /foo,/foo/bar "$TEST_NAME"
|
|
# bundles created with the testlib add all needed directories to the
|
|
# manifest by default, so we need to remove the directory from test-bundle1
|
|
# so its missing the path to the file.
|
|
remove_from_manifest "$WEB_DIR"/10/Manifest.test-bundle1 /foo
|
|
remove_from_manifest "$WEB_DIR"/10/Manifest.test-bundle1 /foo/bar
|
|
# since test-bundle2 is already installed, both directories defined
|
|
# there already exist, so we need to delete one of the /foo/bar so it
|
|
# can be fixed using verify_fix_path
|
|
sudo rm -rf "$TARGET_DIR"/foo/bar
|
|
|
|
}
|
|
|
|
@test "ADD022: When adding a bundle and a path is missing on the fs, bundle-add fixes it" {
|
|
|
|
assert_dir_not_exists "$TARGET_DIR"/foo/bar
|
|
|
|
run sudo sh -c "$SWUPD bundle-add $SWUPD_OPTS test-bundle1"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
Loading required manifests...
|
|
No packs need to be downloaded
|
|
Validate downloaded files
|
|
Starting download of remaining update content. This may take a while...
|
|
Installing files...
|
|
Calling post-update helper scripts
|
|
Successfully installed 1 bundle
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
assert_file_exists "$TARGET_DIR"/foo/bar/test-file1
|
|
|
|
}
|
|
#WEIGHT=3
|