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>
88 lines
1.8 KiB
Bash
Executable File
88 lines
1.8 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" 10 1
|
|
|
|
create_third_party_repo -a "$TEST_NAME" 10 1 repo1
|
|
CACHE1="$ABS_TP_CACHE_DIR"
|
|
sudo mkdir -p "$ABS_TP_MANIFEST_DIR"/10
|
|
sudo touch "$ABS_TP_MANIFEST_DIR"/10/Manifest.test{1..3}
|
|
sudo touch "$CACHE1"/pack-test{1..2}-from-0.tar
|
|
|
|
create_third_party_repo -a "$TEST_NAME" 10 1 repo2
|
|
CACHE2="$ABS_TP_CACHE_DIR"
|
|
sudo touch "$CACHE2"/pack-test3-from-0.tar
|
|
|
|
}
|
|
|
|
|
|
@test "API065: 3rd-party clean" {
|
|
|
|
run sudo sh -c "$SWUPD 3rd-party clean $SWUPD_OPTS --quiet"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
[repo1]
|
|
[repo2]
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "API066: 3rd-party clean --dry-run" {
|
|
|
|
run sudo sh -c "$SWUPD 3rd-party clean $SWUPD_OPTS --dry-run --quiet"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
\\[repo1\\]
|
|
$CACHE1/pack-test.-from-0.tar
|
|
$CACHE1/pack-test.-from-0.tar
|
|
$CACHE1/delta
|
|
$CACHE1/download
|
|
$CACHE1/staged
|
|
$CACHE1/temp
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
\\[repo2\\]
|
|
$CACHE2/pack-test3-from-0.tar
|
|
$CACHE2/delta
|
|
$CACHE2/download
|
|
$CACHE2/staged
|
|
$CACHE2/temp
|
|
EOM
|
|
)
|
|
assert_regex_is_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "API067: 3rd-party clean --dry-run --repo REPOSITORY" {
|
|
|
|
run sudo sh -c "$SWUPD 3rd-party clean $SWUPD_OPTS --dry-run --quiet --repo repo1"
|
|
|
|
assert_status_is "$SWUPD_OK"
|
|
expected_output=$(cat <<-EOM
|
|
$CACHE1/pack-test.-from-0.tar
|
|
$CACHE1/pack-test.-from-0.tar
|
|
$CACHE1/delta
|
|
$CACHE1/download
|
|
$CACHE1/staged
|
|
$CACHE1/temp
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
$CACHE1/manifest/10/Manifest.test.
|
|
EOM
|
|
)
|
|
assert_regex_is_output "$expected_output"
|
|
|
|
}
|
|
#WEIGHT=13
|