Skip to content

Commit

Permalink
fix(nightly): increase nightly delays and timeouts
Browse files Browse the repository at this point in the history
change the startup dedupe blackbox test source image with a lighter one

Signed-off-by: Petu Eusebiu <[email protected]>
  • Loading branch information
eusebiu-constantin-petu-dbk committed Oct 4, 2023
1 parent 99e29c0 commit 8359d9f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 46 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: 'Nightly jobs'
on:
pull_request:
branches: [main]
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
Expand Down Expand Up @@ -98,7 +100,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-*
Expand Down Expand Up @@ -135,7 +137,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-*
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox/helpers_zot.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down
50 changes: 24 additions & 26 deletions test/blackbox/pushpull_running_dedupe.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`

Expand All @@ -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
}
Expand All @@ -119,15 +119,16 @@ 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
}

@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`

Expand All @@ -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))
Expand All @@ -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))
Expand All @@ -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"' ]
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
28 changes: 17 additions & 11 deletions test/blackbox/restore_s3_blobs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ 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
local zot_config_file_nodedupe=${BATS_FILE_TMPDIR}/zot_config_nodedupe.json
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
Expand Down Expand Up @@ -62,6 +63,7 @@ EOF
"storage": {
"rootDirectory": "${zot_root_dir}",
"dedupe": false,
"gc": false,
"storageDriver": {
"name": "s3",
"rootdirectory": "/zot",
Expand Down Expand Up @@ -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
}
Expand All @@ -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`
Expand All @@ -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 ]
}

Expand Down
6 changes: 3 additions & 3 deletions test/gc-stress/config-gc-bench-s3-localstack.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"rootDirectory": "/tmp/zot/s3",
"gc": true,
"gcReferrers": false,
"gcDelay": "50m",
"untaggedImageRetentionDelay": "50m",
"gcInterval": "2m",
"gcDelay": "80m",
"untaggedImageRetentionDelay": "80m",
"gcInterval": "5m",
"storageDriver": {
"name": "s3",
"rootdirectory": "/zot",
Expand Down
6 changes: 3 additions & 3 deletions test/gc-stress/config-gc-referrers-bench-s3-localstack.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"rootDirectory": "/tmp/zot/s3",
"gc": true,
"gcReferrers": true,
"gcDelay": "50m",
"untaggedImageRetentionDelay": "50m",
"gcInterval": "2m",
"gcDelay": "80m",
"untaggedImageRetentionDelay": "80m",
"gcInterval": "5m",
"storageDriver": {
"name": "s3",
"rootdirectory": "/zot",
Expand Down

0 comments on commit 8359d9f

Please sign in to comment.