0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

fix(nightly): increase nightly delays and timeouts (#1877)

change the startup dedupe blackbox test source image with a lighter one

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu 2023-10-12 16:42:07 +03:00 committed by GitHub
parent a91c0c5cfe
commit 458d40fb48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 40 deletions

View file

@ -98,7 +98,7 @@ jobs:
make bench
./bin/zot-linux-amd64 serve test/gc-stress/config-gc-referrers-bench-s3-localstack.json &
sleep 10
bin/zb-linux-amd64 -c 10 -n 100 -o ci-cd http://localhost:8080
bin/zb-linux-amd64 -c 10 -n 100 -o ci-cd http://localhost:8080 --skip-cleanup
killall -r zot-*
@ -135,7 +135,7 @@ jobs:
make bench
./bin/zot-linux-amd64 serve test/gc-stress/config-gc-bench-s3-localstack.json &
sleep 10
bin/zb-linux-amd64 -c 10 -n 100 -o ci-cd http://localhost:8080
bin/zb-linux-amd64 -c 10 -n 100 -o ci-cd http://localhost:8080 --skip-cleanup
killall -r zot-*

View file

@ -31,7 +31,7 @@ function wait_zot_reachable() {
--max-time 3 \
--retry 10 \
--retry-delay 0 \
--retry-max-time 60 \
--retry-max-time 120 \
--retry-connrefused \
${zot_url}
}

View file

@ -24,7 +24,7 @@ function setup_file() {
exit 1
fi
# Download test data to folder common for the entire suite, not just this file
skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/golang:1.20 oci:${TEST_DATA_DIR}/golang:1.20
skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/test-images/alpine:3.17.3 oci:${TEST_DATA_DIR}/alpine:1
# Setup zot server
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
local zot_config_file=${BATS_FILE_TMPDIR}/zot_config.json
@ -67,8 +67,8 @@ function teardown_file() {
@test "push image - dedupe not running" {
start=`date +%s`
run skopeo --insecure-policy copy --dest-tls-verify=false \
oci:${TEST_DATA_DIR}/golang:1.20 \
docker://127.0.0.1:8080/golang:1.20
oci:${TEST_DATA_DIR}/alpine:1 \
docker://127.0.0.1:8080/alpine:1
[ "$status" -eq 0 ]
end=`date +%s`
@ -77,34 +77,34 @@ function teardown_file() {
run curl http://127.0.0.1:8080/v2/_catalog
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[]') = '"golang"' ]
run curl http://127.0.0.1:8080/v2/golang/tags/list
[ $(echo "${lines[-1]}" | jq '.repositories[]') = '"alpine"' ]
run curl http://127.0.0.1:8080/v2/alpine/tags/list
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"1.20"' ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"1"' ]
}
@test "pull image - dedupe not running" {
local oci_data_dir=${BATS_FILE_TMPDIR}/oci
start=`date +%s`
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8080/golang:1.20 \
oci:${oci_data_dir}/golang:1.20
docker://127.0.0.1:8080/alpine:1 \
oci:${oci_data_dir}/alpine:1
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
echo "pull image exec time: $runtime sec" >&3
run cat ${BATS_FILE_TMPDIR}/oci/golang/index.json
run cat ${BATS_FILE_TMPDIR}/oci/alpine/index.json
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.manifests[].annotations."org.opencontainers.image.ref.name"') = '"1.20"' ]
[ $(echo "${lines[-1]}" | jq '.manifests[].annotations."org.opencontainers.image.ref.name"') = '"1"' ]
}
@test "push 50 images with dedupe disabled" {
for i in {1..50}
do
run skopeo --insecure-policy copy --dest-tls-verify=false \
oci:${TEST_DATA_DIR}/golang:1.20 \
docker://127.0.0.1:8080/golang${i}:1.20
oci:${TEST_DATA_DIR}/alpine:1 \
docker://127.0.0.1:8080/alpine${i}:1
[ "$status" -eq 0 ]
done
}
@ -119,6 +119,7 @@ function teardown_file() {
sed -i 's/false/true/g' ${zot_config_file}
zot_serve ${ZOT_PATH} ${zot_config_file}
wait_zot_reachable 8080
# deduping will now run in background (task scheduler) while we push images, shouldn't interfere
}
@ -126,8 +127,8 @@ function teardown_file() {
@test "push image - dedupe running" {
start=`date +%s`
run skopeo --insecure-policy copy --dest-tls-verify=false \
oci:${TEST_DATA_DIR}/golang:1.20 \
docker://127.0.0.1:8080/dedupe/golang:1.20
oci:${TEST_DATA_DIR}/alpine:1 \
docker://127.0.0.1:8080/dedupe/alpine:1
[ "$status" -eq 0 ]
end=`date +%s`
@ -142,8 +143,8 @@ function teardown_file() {
start=`date +%s`
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8080/dedupe/golang:1.20 \
oci:${oci_data_dir}/dedupe/golang:1.20
docker://127.0.0.1:8080/dedupe/alpine:1 \
oci:${oci_data_dir}/dedupe/alpine:1
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
@ -158,8 +159,8 @@ function teardown_file() {
start=`date +%s`
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8080/golang2:1.20 \
oci:${oci_data_dir}/dedupe/golang2:1.20
docker://127.0.0.1:8080/alpine2:1 \
oci:${oci_data_dir}/dedupe/alpine2:1
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
@ -179,9 +180,6 @@ function teardown_file() {
runtime=$((end-start))
echo "push image index exec time: $runtime sec" >&3
run curl http://127.0.0.1:8080/v2/_catalog
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[0]') = '"busybox"' ]
run curl http://127.0.0.1:8080/v2/busybox/tags/list
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
@ -243,16 +241,16 @@ function teardown_file() {
# attach signature
echo "{\"artifact\": \"\", \"signature\": \"pat hancock\"}" > ${BATS_FILE_TMPDIR}/signature.json
start=`date +%s`
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --image-spec v1.1-image --artifact-type 'signature/example' ${BATS_FILE_TMPDIR}/signature.json:application/json
run oras attach --plain-http 127.0.0.1:8080/alpine:1 --image-spec v1.1-image --artifact-type 'signature/example' ${BATS_FILE_TMPDIR}/signature.json:application/json
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
echo "attach signature exec time: $runtime sec" >&3
# attach sbom
echo "{\"version\": \"0.0.0.0\", \"artifact\": \"'127.0.0.1:8080/golang:1.20'\", \"contents\": \"good\"}" > ${BATS_FILE_TMPDIR}/sbom.json
echo "{\"version\": \"0.0.0.0\", \"artifact\": \"'127.0.0.1:8080/alpine:1'\", \"contents\": \"good\"}" > ${BATS_FILE_TMPDIR}/sbom.json
start=`date +%s`
run oras attach --plain-http 127.0.0.1:8080/golang:1.20 --image-spec v1.1-image --artifact-type 'sbom/example' ${BATS_FILE_TMPDIR}/sbom.json:application/json
run oras attach --plain-http 127.0.0.1:8080/alpine:1 --image-spec v1.1-image --artifact-type 'sbom/example' ${BATS_FILE_TMPDIR}/sbom.json:application/json
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
@ -262,7 +260,7 @@ function teardown_file() {
@test "discover oras artifacts - dedupe running" {
start=`date +%s`
run oras discover --plain-http -o json 127.0.0.1:8080/golang:1.20
run oras discover --plain-http -o json 127.0.0.1:8080/alpine:1
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))
@ -299,7 +297,7 @@ function teardown_file() {
run regctl registry set localhost:8080 --tls disabled
[ "$status" -eq 0 ]
start=`date +%s`
run regctl image copy ocidir://${TEST_DATA_DIR}/golang:1.20 localhost:8080/test-regclient
run regctl image copy ocidir://${TEST_DATA_DIR}/alpine:1 localhost:8080/test-regclient
[ "$status" -eq 0 ]
end=`date +%s`
runtime=$((end-start))

View file

@ -12,7 +12,7 @@ function setup_file() {
fi
# Download test data to folder common for the entire suite, not just this file
skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/golang:1.20 oci:${TEST_DATA_DIR}/golang:1.20
skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/test-images/alpine:3.17.3 oci:${TEST_DATA_DIR}/alpine:1
# Setup zot server
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
local zot_config_file_dedupe=${BATS_FILE_TMPDIR}/zot_config_dedupe.json
@ -20,6 +20,7 @@ function setup_file() {
local ZOT_LOG_FILE_DEDUPE=${BATS_FILE_TMPDIR}/zot-log-dedupe.json
local ZOT_LOG_FILE_NODEDUPE=${BATS_FILE_TMPDIR}/zot-log-nodedupe.json
touch ${ZOT_LOG_FILE_NODEDUPE}
mkdir -p ${zot_root_dir}
cat > ${zot_config_file_dedupe}<<EOF
@ -62,6 +63,7 @@ EOF
"storage": {
"rootDirectory": "${zot_root_dir}",
"dedupe": false,
"gc": false,
"storageDriver": {
"name": "s3",
"rootdirectory": "/zot",
@ -106,8 +108,8 @@ function teardown_file() {
for i in {1..50}
do
run skopeo --insecure-policy copy --dest-tls-verify=false \
oci:${TEST_DATA_DIR}/golang:1.20 \
docker://127.0.0.1:8080/golang${i}:1.20
oci:${TEST_DATA_DIR}/alpine:1 \
docker://127.0.0.1:8080/alpine${i}:1
[ "$status" -eq 0 ]
done
}
@ -124,10 +126,12 @@ function teardown_file() {
# start with dedupe disabled
zot_serve ${zot_config_file_nodedupe}
wait_zot_reachable 8080
sleep 1 # if we wait for zot to be reachable we may not catch the log message
start=`date +%s`
echo "waiting for restoring blobs task to finish" >&3
run wait_for_string "dedupe rebuild: finished" ${ZOT_LOG_FILE} "10m"
run wait_for_string "dedupe rebuild: finished" ${ZOT_LOG_FILE} "5m"
[ "$status" -eq 0 ]
end=`date +%s`
@ -138,18 +142,20 @@ function teardown_file() {
}
@test "pulling a previous deduped image should work" {
# golang1 should have original blobs already
wait_zot_reachable 8080
# alpine1 should have original blobs already
echo "pulling first image" >&3
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8080/golang1:1.20 \
oci:${TEST_DATA_DIR}/golang1:1.20
docker://127.0.0.1:8080/alpine1:1 \
oci:${TEST_DATA_DIR}/alpine1:1
[ "$status" -eq 0 ]
echo "pulling second image" >&3
# golang2 should have original blobs after restoring blobs
# alpine2 should have original blobs after restoring blobs
run skopeo --insecure-policy copy --src-tls-verify=false \
docker://127.0.0.1:8080/golang2:1.20 \
oci:${TEST_DATA_DIR}/golang2:1.20
docker://127.0.0.1:8080/alpine2:1 \
oci:${TEST_DATA_DIR}/alpine2:1
[ "$status" -eq 0 ]
}