2023-09-07 21:06:21 +03:00
# Note: Intended to be run as "make run-blackbox-tests" or "make run-blackbox-ci"
2023-08-30 22:24:28 +03:00
# 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
if [ ! $(command -v docker) ]; then
echo "you need to install docker as a prerequisite to running the tests" >&3
return 1
fi
return 0
}
2022-12-16 19:33:46 +02:00
function setup_file() {
# Verify prerequisites are available
2023-08-30 22:24:28 +03:00
if ! $(verify_prerequisites); then
2022-12-16 19:33:46 +02:00
exit 1
fi
# Setup zot server
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
local zot_sync_ondemand_config_file=${BATS_FILE_TMPDIR}/zot_sync_ondemand_config.json
2023-11-15 20:44:31 +02:00
zot_port=$(get_free_port)
echo ${zot_port} > ${BATS_FILE_TMPDIR}/zot.port
2022-12-16 19:33:46 +02:00
mkdir -p ${zot_root_dir}
cat >${zot_sync_ondemand_config_file} <<EOF
{
2024-02-20 13:27:21 +02:00
"distSpecVersion": "1.1.0",
2022-12-16 19:33:46 +02:00
"storage": {
"rootDirectory": "${zot_root_dir}"
},
"http": {
"address": "0.0.0.0",
2023-11-15 20:44:31 +02:00
"port": "${zot_port}"
2022-12-16 19:33:46 +02:00
},
"log": {
2023-05-31 20:26:23 +03:00
"level": "debug",
"output": "/tmp/blackbox.log"
2022-12-16 19:33:46 +02:00
},
"extensions": {
"sync": {
"registries": [
{
"urls": [
2023-09-13 20:00:51 +03:00
"https://index.docker.io"
2023-05-31 20:26:23 +03:00
],
"content": [
{
2023-08-30 22:24:28 +03:00
"prefix": "registry"
},
{
"prefix": "archlinux"
}
],
2023-05-31 20:26:23 +03:00
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
"https://registry.k8s.io"
],
"content": [
{
2023-08-30 22:24:28 +03:00
"prefix": "kube-apiserver"
},
{
"prefix": "pause"
},
2023-05-31 20:26:23 +03:00
{
"prefix": "kube-apiserver-amd64"
}
2023-08-30 22:24:28 +03:00
],
2023-05-31 20:26:23 +03:00
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
"https://public.ecr.aws"
],
"content": [
2023-08-30 22:24:28 +03:00
{
"prefix": "amazonlinux/amazonlinux"
}
],
2023-05-31 20:26:23 +03:00
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
"https://gcr.io"
],
"content": [
2023-08-30 22:24:28 +03:00
{
"prefix": "google-containers/kube-proxy-amd64"
}
],
2023-05-31 20:26:23 +03:00
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
2023-05-04 19:34:35 +03:00
"https://mcr.microsoft.com"
2022-12-16 19:33:46 +02:00
],
2023-05-31 20:26:23 +03:00
"content": [
2023-08-30 22:24:28 +03:00
{
"prefix": "azure-cognitive-services/vision/spatial-analysis/diagnostics"
}
],
2022-12-16 19:33:46 +02:00
"onDemand": true,
"tlsVerify": true
2023-06-30 21:07:04 +03:00
},
{
"urls": [
"https://registry.gitlab.com"
],
"content": [
{
"prefix": "gitlab-org/public-image-archive/gitlab-ee"
}
],
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
"https://quay.io"
],
"content": [
{
"prefix": "coreos/etcd"
}
],
"onDemand": true,
"tlsVerify": true
},
{
"urls": [
"https://ghcr.io"
],
"content": [
{
"prefix": "project-zot/zot-linux-amd64"
}
],
"onDemand": true,
"tlsVerify": true
2022-12-16 19:33:46 +02:00
}
]
}
}
}
EOF
2023-08-30 22:24:28 +03:00
zot_serve ${ZOT_PATH} ${zot_sync_ondemand_config_file}
2023-11-15 20:44:31 +02:00
wait_zot_reachable ${zot_port}
2022-12-16 19:33:46 +02:00
}
function teardown_file() {
2023-08-30 22:24:28 +03:00
zot_stop_all
2022-12-16 19:33:46 +02:00
}
# sync image
2022-12-22 19:23:49 +02:00
@test "sync docker image list on demand" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2022-12-22 19:23:49 +02:00
run skopeo --insecure-policy copy --multi-arch=all --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/registry \
2022-12-16 19:33:46 +02:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2022-12-16 19:33:46 +02:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[]') = '"registry"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/registry/tags/list
2022-12-16 19:33:46 +02:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
2023-06-21 21:05:52 +03:00
# make sure image is skipped when synced again
run skopeo --insecure-policy copy --multi-arch=all --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/registry \
2023-06-21 21:05:52 +03:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run $("cat /tmp/blackbox.log | grep -q registry:latest.*.skipping image because it's already synced")
[ "$status" -eq 0 ]
2022-12-16 19:33:46 +02:00
}
2022-12-22 19:23:49 +02:00
@test "sync docker image on demand" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2022-12-22 19:23:49 +02:00
run skopeo --insecure-policy copy --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/archlinux \
2022-12-22 19:23:49 +02:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2022-12-22 19:23:49 +02:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[0]') = '"archlinux"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/archlinux/tags/list
2023-05-31 20:26:23 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
2023-06-21 21:05:52 +03:00
# make sure image is skipped when synced again
run skopeo --insecure-policy copy --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/archlinux \
2023-06-21 21:05:52 +03:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
run $("cat /tmp/blackbox.log | grep -q archlinux:latest.*.skipping image because it's already synced")
[ "$status" -eq 0 ]
2023-05-31 20:26:23 +03:00
}
@test "sync k8s image list on demand" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2023-05-31 20:26:23 +03:00
run skopeo --insecure-policy copy --multi-arch=all --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/kube-apiserver:v1.26.0 \
2023-05-31 20:26:23 +03:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-31 20:26:23 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[1]') = '"kube-apiserver"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/kube-apiserver/tags/list
2023-05-31 20:26:23 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v1.26.0"' ]
}
@test "sync k8s image on demand" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2023-05-31 20:26:23 +03:00
run skopeo --insecure-policy copy --src-tls-verify=false \
2023-11-15 20:44:31 +02:00
docker://127.0.0.1:${zot_port}/pause \
2023-05-31 20:26:23 +03:00
oci:${TEST_DATA_DIR}
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-31 20:26:23 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.repositories[2]') = '"pause"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/pause/tags/list
2022-12-22 19:23:49 +02:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
}
2023-05-04 19:34:35 +03:00
@test "sync image on demand from registry.k8s.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/kube-apiserver-amd64:v1.10.0 oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "kube-apiserver-amd64"))' | jq '.[]') = '"kube-apiserver-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/kube-apiserver-amd64/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v1.10.0"' ]
}
@test "sync image on demand from aws.amazon.com/ecr" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/amazonlinux/amazonlinux:latest oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-05-31 20:26:23 +03:00
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "amazonlinux/amazonlinux"))' | jq '.[]') = '"amazonlinux/amazonlinux"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/amazonlinux/amazonlinux/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
}
@test "sync image on demand from gcr.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/google-containers/kube-proxy-amd64:v1.17.9 oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "google-containers/kube-proxy-amd64"))' | jq '.[]') = '"google-containers/kube-proxy-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/google-containers/kube-proxy-amd64/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v1.17.9"' ]
}
@test "sync image on demand from mcr.microsoft.com" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/azure-cognitive-services/vision/spatial-analysis/diagnostics:latest oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "azure-cognitive-services/vision/spatial-analysis/diagnostics"))' | jq '.[]') = '"azure-cognitive-services/vision/spatial-analysis/diagnostics"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/azure-cognitive-services/vision/spatial-analysis/diagnostics/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
}
2023-06-30 21:07:04 +03:00
@test "sync image on demand from registry.gitlab.com" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/gitlab-org/public-image-archive/gitlab-ee:15.11.6-ee.0 oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "gitlab-org/public-image-archive/gitlab-ee"))' | jq '.[]') = '"gitlab-org/public-image-archive/gitlab-ee"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/gitlab-org/public-image-archive/gitlab-ee/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"15.11.6-ee.0"' ]
}
@test "sync image on demand from quay.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run skopeo copy docker://127.0.0.1:${zot_port}/coreos/etcd:v3.4.26 oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "coreos/etcd"))' | jq '.[]') = '"coreos/etcd"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/coreos/etcd/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v3.4.26"' ]
}
@test "sync image on demand from ghcr.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2024-03-06 12:16:42 -08:00
run skopeo copy docker://127.0.0.1:${zot_port}/project-zot/zot-linux-amd64:v2.0.1 oci:${TEST_DATA_DIR} --src-tls-verify=false
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "project-zot/zot-linux-amd64"))' | jq '.[]') = '"project-zot/zot-linux-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/project-zot/zot-linux-amd64/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2024-03-06 12:16:42 -08:00
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v2.0.1"' ]
2023-06-30 21:07:04 +03:00
}
2023-09-13 20:00:51 +03:00
@test "run docker with image synced from docker.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2023-08-30 22:24:28 +03:00
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
2023-05-04 19:34:35 +03:00
run rm -rf ${zot_root_dir}
[ "$status" -eq 0 ]
2023-08-30 22:24:28 +03:00
2023-11-15 20:44:31 +02:00
run docker run -d 127.0.0.1:${zot_port}/archlinux:latest
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "archlinux"))' | jq '.[]') = '"archlinux"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/archlinux/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
run docker kill $(docker ps -q)
}
@test "run docker with image synced from registry.k8s.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/kube-apiserver-amd64:v1.10.0
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "kube-apiserver-amd64"))' | jq '.[]') = '"kube-apiserver-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/kube-apiserver-amd64/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v1.10.0"' ]
run docker kill $(docker ps -q)
}
@test "run docker with image synced from aws.amazon.com/ecr" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/amazonlinux/amazonlinux:latest
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-05-31 20:26:23 +03:00
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "amazonlinux/amazonlinux"))' | jq '.[]') = '"amazonlinux/amazonlinux"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/amazonlinux/amazonlinux/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
run docker kill $(docker ps -q)
}
@test "run docker with image synced from gcr.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/google-containers/kube-proxy-amd64:v1.17.9
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "google-containers/kube-proxy-amd64"))' | jq '.[]') = '"google-containers/kube-proxy-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/google-containers/kube-proxy-amd64/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v1.17.9"' ]
run docker kill $(docker ps -q)
}
@test "run docker with image synced from mcr.microsoft.com" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/azure-cognitive-services/vision/spatial-analysis/diagnostics:latest
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "azure-cognitive-services/vision/spatial-analysis/diagnostics"))' | jq '.[]') = '"azure-cognitive-services/vision/spatial-analysis/diagnostics"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/azure-cognitive-services/vision/spatial-analysis/diagnostics/tags/list
2023-05-04 19:34:35 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"latest"' ]
run docker kill $(docker ps -q)
}
2023-06-30 21:07:04 +03:00
@test "run docker with image synced from registry.gitlab.com" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/gitlab-org/public-image-archive/gitlab-ee:15.11.6-ee.0
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "gitlab-org/public-image-archive/gitlab-ee"))' | jq '.[]') = '"gitlab-org/public-image-archive/gitlab-ee"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/gitlab-org/public-image-archive/gitlab-ee/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"15.11.6-ee.0"' ]
}
@test "run docker with image synced from quay.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
run docker run -d 127.0.0.1:${zot_port}/coreos/etcd:v3.4.26
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "coreos/etcd"))' | jq '.[]') = '"coreos/etcd"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/coreos/etcd/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v3.4.26"' ]
}
@test "run docker with image synced from ghcr.io" {
2023-11-15 20:44:31 +02:00
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
2024-03-06 12:16:42 -08:00
run docker run -d 127.0.0.1:${zot_port}/project-zot/zot-linux-amd64:v2.0.1
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/_catalog
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}"| jq '.repositories | map(select(. == "project-zot/zot-linux-amd64"))' | jq '.[]') = '"project-zot/zot-linux-amd64"' ]
2023-11-15 20:44:31 +02:00
run curl http://127.0.0.1:${zot_port}/v2/project-zot/zot-linux-amd64/tags/list
2023-06-30 21:07:04 +03:00
[ "$status" -eq 0 ]
2024-03-06 12:16:42 -08:00
[ $(echo "${lines[-1]}" | jq '.tags[]') = '"v2.0.1"' ]
2023-06-30 21:07:04 +03:00
}