Files
William Douglas 776f8c92b0 Update use bats setup and teardown features
Instead of relying on a custom global_setup and global_teardown
functions, migrate to the use of bats' setup_file and teardown_file
functions.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-02-17 12:58:05 -08:00

61 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bats
load "../testlib"
setup_file() {
create_test_environment "$TEST_NAME"
create_bundle -n test-bundle1 -f /foo "$TEST_NAME"
create_bundle -n test-bundle2 -f /bar "$TEST_NAME"
create_bundle -L -n test-bundle3 -f /baz "$TEST_NAME"
create_bundle -L -t -n test-bundle4 -f /bat "$TEST_NAME"
}
teardown_file() {
destroy_test_environment --force "$TEST_NAME"
}
@test "LST002: List all available bundles" {
run sudo sh -c "$SWUPD bundle-list $SWUPD_OPTS --all"
assert_status_is 0
expected_output=$(cat <<-EOM
All available bundles:
- os-core
- test-bundle1
- test-bundle2
- test-bundle3
- test-bundle4
Total: 5
EOM
)
assert_is_output --identical "$expected_output"
}
@test "LST026: List all available bundles and their installation status" {
run sudo sh -c "$SWUPD bundle-list $SWUPD_OPTS --all --status"
assert_status_is 0
expected_output=$(cat <<-EOM
All available bundles:
- os-core (installed)
- test-bundle1
- test-bundle2
- test-bundle3 (installed)
- test-bundle4 (explicitly installed)
Total: 5
EOM
)
assert_is_output --identical "$expected_output"
}
#WEIGHT=8