Files
zot/test/blackbox/scrub.bats
T
peusebiu b80deb9927 refactor(storage): refactor storage into a single ImageStore (#1656)
unified both local and s3 ImageStore logic into a single ImageStore
added a new driver interface for common file/dirs manipulations
to be implemented by different storage types

refactor(gc): drop umoci dependency, implemented internal gc

added retentionDelay config option that specifies
the garbage collect delay for images without tags

this will also clean manifests which are part of an index image
(multiarch) that no longer exist.

fix(dedupe): skip blobs under .sync/ directory

if startup dedupe is running while also syncing is running
ignore blobs under sync's temporary storage

fix(storage): do not allow image indexes modifications

when deleting a manifest verify that it is not part of a multiarch image
and throw a MethodNotAllowed error to the client if it is.
we don't want to modify multiarch images

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
2023-09-01 10:54:39 -07:00

88 lines
2.0 KiB
Bash

# Note: Intended to be run as "make test-bats-scrub" or "make test-bats-scrub-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
load helpers_scrub
function verify_prerequisites() {
return 0
}
function setup_file(){
skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/golang:1.20 oci:${TEST_DATA_DIR}/golang:1.20
}
function setup() {
# verify prerequisites are available
if ! $(verify_prerequisites); then
exit 1
fi
# Setup zot server
ZOT_ROOT_DIR=${BATS_FILE_TMPDIR}/zot
echo ${ZOT_ROOT_DIR}
ZOT_LOG_FILE=${ZOT_ROOT_DIR}/zot-log.json
ZOT_CONFIG_FILE=${BATS_FILE_TMPDIR}/zot_config.json
mkdir -p ${ZOT_ROOT_DIR}
touch ${ZOT_LOG_FILE}
cat >${ZOT_CONFIG_FILE} <<EOF
{
"distSpecVersion": "1.1.0-dev",
"storage": {
"rootDirectory": "${ZOT_ROOT_DIR}",
"dedupe": false
},
"http": {
"address": "0.0.0.0",
"port": "8080"
},
"log": {
"level": "debug",
"output": "${ZOT_LOG_FILE}"
},
"extensions": {
"scrub": {
"enable": true,
"interval": "2h"
}
}
}
EOF
}
function teardown() {
zot_stop_all
}
@test "blobs/manifest integrity not affected" {
add_test_files
echo ${ZOT_CONFIG_FILE}
zot_serve ${ZOT_PATH} ${ZOT_CONFIG_FILE}
wait_zot_reachable 8080
# wait for scrub to be done and logs to get populated
run sleep 20s
run not_affected
[ "$status" -eq 0 ]
[ $(echo "${lines[0]}" ) = 'true' ]
}
@test "blobs/manifest integrity affected" {
add_test_files
delete_blob
echo ${ZOT_CONFIG_FILE}
zot_serve ${ZOT_PATH} ${ZOT_CONFIG_FILE}
wait_zot_reachable 8080
# wait for scrub to be done and logs to get populated
run sleep 20s
run affected
[ "$status" -eq 0 ]
[ $(echo "${lines[0]}" ) = 'true' ]
}