mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
ci: resource tuning for faster runs (#1967)
Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
@@ -32,6 +32,8 @@ function setup_file() {
|
||||
local zot_root_dir=${BATS_FILE_TMPDIR}/zot
|
||||
local zot_config_file=${BATS_FILE_TMPDIR}/zot_config.json
|
||||
local zot_htpasswd_file=${BATS_FILE_TMPDIR}/zot_htpasswd
|
||||
zot_port=$(get_free_port)
|
||||
echo ${zot_port} > ${BATS_FILE_TMPDIR}/zot.port
|
||||
htpasswd -Bbn ${AUTH_USER} ${AUTH_PASS} >> ${zot_htpasswd_file}
|
||||
|
||||
echo ${zot_root_dir} >&3
|
||||
@@ -50,7 +52,7 @@ function setup_file() {
|
||||
},
|
||||
"http": {
|
||||
"address": "127.0.0.1",
|
||||
"port": "8080",
|
||||
"port": "${zot_port}",
|
||||
"realm":"zot",
|
||||
"auth": {
|
||||
"htpasswd": {
|
||||
@@ -78,7 +80,7 @@ function setup_file() {
|
||||
}
|
||||
EOF
|
||||
zot_serve ${ZOT_PATH} ${zot_config_file}
|
||||
wait_zot_reachable 8080
|
||||
wait_zot_reachable ${zot_port}
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
@@ -91,77 +93,83 @@ function teardown_file() {
|
||||
}
|
||||
|
||||
@test "push image with regclient" {
|
||||
run regctl registry set localhost:8080 --tls disabled
|
||||
run regctl registry login localhost:8080 -u ${AUTH_USER} -p ${AUTH_PASS}
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl registry set localhost:${zot_port} --tls disabled
|
||||
run regctl registry login localhost:${zot_port} -u ${AUTH_USER} -p ${AUTH_PASS}
|
||||
[ "$status" -eq 0 ]
|
||||
run regctl image copy ocidir://${TEST_DATA_DIR}/busybox:1.36 localhost:8080/test-regclient
|
||||
run regctl image copy ocidir://${TEST_DATA_DIR}/busybox:1.36 localhost:${zot_port}/test-regclient
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "pull image with regclient" {
|
||||
run regctl image copy localhost:8080/test-regclient ocidir://${TEST_DATA_DIR}/busybox:latest
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl image copy localhost:${zot_port}/test-regclient ocidir://${TEST_DATA_DIR}/busybox:latest
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "push OCI artifact with regclient" {
|
||||
run regctl artifact put localhost:8080/artifact:demo <<EOF
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl artifact put localhost:${zot_port}/artifact:demo <<EOF
|
||||
this is an artifact
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "pull OCI artifact with regclient" {
|
||||
run regctl manifest get localhost:8080/artifact:demo
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl manifest get localhost:${zot_port}/artifact:demo
|
||||
[ "$status" -eq 0 ]
|
||||
run regctl artifact get localhost:8080/artifact:demo
|
||||
run regctl artifact get localhost:${zot_port}/artifact:demo
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[-1]}" == "this is an artifact" ]
|
||||
}
|
||||
|
||||
@test "push OCI artifact references with regclient" {
|
||||
run regctl artifact put localhost:8080/manifest-ref:demo <<EOF
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl artifact put localhost:${zot_port}/manifest-ref:demo <<EOF
|
||||
test artifact
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
run regctl artifact list localhost:8080/manifest-ref:demo --format raw-body
|
||||
run regctl artifact list localhost:${zot_port}/manifest-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:8080/manifest-ref:demo << EOF
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:${zot_port}/manifest-ref:demo << EOF
|
||||
test reference
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
# with artifact media-type
|
||||
run regctl artifact put localhost:8080/artifact-ref:demo <<EOF
|
||||
run regctl artifact put localhost:${zot_port}/artifact-ref:demo <<EOF
|
||||
test artifact
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
run regctl artifact list localhost:8080/artifact-ref:demo --format raw-body
|
||||
run regctl artifact list localhost:${zot_port}/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:8080/artifact-ref:demo << EOF
|
||||
run regctl artifact put --annotation demo=true --annotation format=oci --artifact-type "application/vnd.example.icecream.v1" --subject localhost:${zot_port}/artifact-ref:demo << EOF
|
||||
test reference
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "list OCI artifact references with regclient" {
|
||||
run regctl artifact list localhost:8080/manifest-ref:demo --format raw-body
|
||||
zot_port=`cat ${BATS_FILE_TMPDIR}/zot.port`
|
||||
run regctl artifact list localhost:${zot_port}/manifest-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 1 ]
|
||||
run regctl artifact list --filter-artifact-type "application/vnd.example.icecream.v1" localhost:8080/manifest-ref:demo --format raw-body
|
||||
run regctl artifact list --filter-artifact-type "application/vnd.example.icecream.v1" localhost:${zot_port}/manifest-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 1 ]
|
||||
run regctl artifact list --filter-artifact-type "application/invalid" localhost:8080/manifest-ref:demo --format raw-body
|
||||
run regctl artifact list --filter-artifact-type "application/invalid" localhost:${zot_port}/manifest-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
# with artifact media-type
|
||||
run regctl artifact list localhost:8080/artifact-ref:demo --format raw-body
|
||||
run regctl artifact list localhost:${zot_port}/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 1 ]
|
||||
run regctl artifact list --filter-artifact-type "application/vnd.example.icecream.v1" localhost:8080/artifact-ref:demo --format raw-body
|
||||
run regctl artifact list --filter-artifact-type "application/vnd.example.icecream.v1" localhost:${zot_port}/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 1 ]
|
||||
run regctl artifact list --filter-artifact-type "application/invalid" localhost:8080/artifact-ref:demo --format raw-body
|
||||
run regctl artifact list --filter-artifact-type "application/invalid" localhost:${zot_port}/artifact-ref:demo --format raw-body
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user