mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
fix: bats test refactoring (#1731)
Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
+25
-9
@@ -1,9 +1,27 @@
|
||||
load helpers_cve
|
||||
# Note: Intended to be run as "make test-bats-cve" or "make test-bats-cve-verbose"
|
||||
# Makefile target installs & checks all necessary tooling
|
||||
# Extra tools that are not covered in Makefile target needs to be added in verify_prerequisites()
|
||||
|
||||
load helpers_zot
|
||||
|
||||
function verify_prerequisites {
|
||||
if [ ! $(command -v curl) ]; then
|
||||
echo "you need to install curl as a prerequisite to running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! $(command -v jq) ]; then
|
||||
echo "you need to install jq as a prerequisite to running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
|
||||
export REGISTRY_NAME=main
|
||||
# Verify prerequisites are available
|
||||
if ! verify_prerequisites; then
|
||||
if ! $(verify_prerequisites); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -15,7 +33,7 @@ function setup_file() {
|
||||
mkdir -p ${zot_root_dir}
|
||||
cat >${zot_config_file} <<EOF
|
||||
{
|
||||
"distSpecVersion": "1.1.0",
|
||||
"distSpecVersion": "1.1.0-dev",
|
||||
"storage": {
|
||||
"rootDirectory": "${zot_root_dir}"
|
||||
},
|
||||
@@ -36,8 +54,8 @@ function setup_file() {
|
||||
}
|
||||
}
|
||||
EOF
|
||||
setup_zot_file_level ${zot_config_file}
|
||||
wait_zot_reachable "http://127.0.0.1:8080/v2/_catalog"
|
||||
zot_serve ${ZOT_PATH} ${zot_config_file}
|
||||
wait_zot_reachable 8080
|
||||
|
||||
# setup zli to add zot registry to configs
|
||||
local registry_name=main
|
||||
@@ -46,9 +64,7 @@ EOF
|
||||
}
|
||||
|
||||
function teardown_file() {
|
||||
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
|
||||
teardown_zot_file_level
|
||||
rm -rf ${zot_root_dir}
|
||||
zot_stop_all
|
||||
}
|
||||
|
||||
@test "cve by image name and tag" {
|
||||
|
||||
Reference in New Issue
Block a user