test/system: Add function for setting up environment

Instead of typing out two function names to set up the test environment,
type out only one. We never know if a new set up function will show up.

https://github.com/containers/toolbox/pull/818
This commit is contained in:
Ondřej Míchal 2021-11-11 02:46:21 +02:00
parent 7a5f3ba2e2
commit fb565af0a0
12 changed files with 19 additions and 19 deletions

View File

@ -3,8 +3,7 @@
load 'libs/helpers' load 'libs/helpers'
@test "test suite: Setup" { @test "test suite: Setup" {
# Setup container storage paths _setup_environment
setup_containers_store
# Cache the default image for the system # Cache the default image for the system
_pull_and_cache_distro_image $(get_system_id) $(get_system_version) || die _pull_and_cache_distro_image $(get_system_id) $(get_system_version) || die
# Cache all images that will be needed during the tests # Cache all images that will be needed during the tests

View File

@ -4,6 +4,10 @@ load 'libs/bats-support/load'
load 'libs/bats-assert/load' load 'libs/bats-assert/load'
load 'libs/helpers.bash' load 'libs/helpers.bash'
setup() {
_setup_environment
}
@test "version: Check version using option --version" { @test "version: Check version using option --version" {
run $TOOLBOX --version run $TOOLBOX --version

View File

@ -5,7 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers.bash' load 'libs/helpers.bash'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
} }
@test "help: Run command 'help'" { @test "help: Run command 'help'" {

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_all cleanup_all
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_containers cleanup_containers
} }

View File

@ -5,8 +5,7 @@ load 'libs/bats-assert/load'
load 'libs/helpers' load 'libs/helpers'
setup() { setup() {
check_xdg_runtime_dir _setup_environment
setup_containers_store
cleanup_all cleanup_all
} }

View File

@ -31,6 +31,11 @@ function cleanup_containers() {
} }
function _setup_environment() {
_setup_containers_store
check_xdg_runtime_dir
}
function _setup_containers_store() { function _setup_containers_store() {
mkdir -p ${TEMP_STORAGE_DIR} mkdir -p ${TEMP_STORAGE_DIR}
# Setup a storage config file for PODMAN # Setup a storage config file for PODMAN