diff --git a/Makefile b/Makefile index d8c0ed37..c57840d4 100644 --- a/Makefile +++ b/Makefile @@ -397,33 +397,33 @@ endif test: build-test-container ifneq ($(RESTY_IMAGE_BASE),src) + CACHE_COMMAND="$(CACHE_COMMAND)" \ + EDITION=$(EDITION) \ + KONG_ADMIN_PORT=8444 \ + KONG_ADMIN_URI="http://$(TEST_HOST):$(TEST_ADMIN_PORT)" \ + KONG_GO_PLUGINSERVER_VERSION=$(KONG_GO_PLUGINSERVER_VERSION) \ + KONG_HOST=127.0.0.1 \ KONG_PACKAGE_NAME=$(KONG_PACKAGE_NAME) \ - VERBOSE=$(VERBOSE) \ + KONG_PROXY_PORT=8000 \ + KONG_PROXY_URI="http://$(TEST_HOST):$(TEST_PROXY_PORT)" \ + KONG_TEST_CONTAINER_NAME=$(KONG_TEST_CONTAINER_NAME) \ + KONG_TEST_CONTAINER_TAG=$(KONG_TEST_CONTAINER_TAG) \ + KONG_TEST_IMAGE_NAME=$(KONG_TEST_IMAGE_NAME) \ KONG_VERSION=$(KONG_VERSION) \ + PACKAGE_LOCATION=$(PWD)/output \ + PACKAGE_TYPE=$(PACKAGE_TYPE) \ RESTY_IMAGE_BASE=$(RESTY_IMAGE_BASE) \ RESTY_IMAGE_TAG=$(RESTY_IMAGE_TAG) \ - PACKAGE_TYPE=$(PACKAGE_TYPE) \ - EDITION=$(EDITION) \ - KONG_TEST_CONTAINER_TAG=$(KONG_TEST_CONTAINER_TAG) \ - KONG_TEST_IMAGE_NAME=$(KONG_TEST_IMAGE_NAME) \ - RESTY_VERSION=$(RESTY_VERSION) \ - RESTY_OPENSSL_VERSION=$(RESTY_OPENSSL_VERSION) \ - SSL_PROVIDER=$(SSL_PROVIDER) \ RESTY_LUAROCKS_VERSION=$(RESTY_LUAROCKS_VERSION) \ + RESTY_OPENSSL_VERSION=$(RESTY_OPENSSL_VERSION) \ RESTY_PCRE_VERSION=$(RESTY_PCRE_VERSION) \ - CACHE_COMMAND="$(CACHE_COMMAND)" \ - UPDATE_CACHE_COMMAND="$(UPDATE_CACHE_COMMAND)" \ - TEST_SHA=$(TEST_SHA) \ - PACKAGE_LOCATION=$(PWD)/output \ - KONG_HOST=127.0.0.1 \ - KONG_ADMIN_PORT=8444 \ - KONG_PROXY_PORT=8000 \ - TEST_HOST=$(TEST_HOST) \ - KONG_TEST_CONTAINER_NAME=$(KONG_TEST_CONTAINER_NAME) \ - KONG_ADMIN_URI="http://$(TEST_HOST):$(TEST_ADMIN_PORT)" \ - KONG_PROXY_URI="http://$(TEST_HOST):$(TEST_PROXY_PORT)" \ + RESTY_VERSION=$(RESTY_VERSION) \ + SSL_PROVIDER=$(SSL_PROVIDER) \ TEST_COMPOSE_PATH=$(TEST_COMPOSE_PATH) \ - KONG_GO_PLUGINSERVER_VERSION=$(KONG_GO_PLUGINSERVER_VERSION) \ + TEST_HOST=$(TEST_HOST) \ + TEST_SHA=$(TEST_SHA) \ + UPDATE_CACHE_COMMAND="$(UPDATE_CACHE_COMMAND)" \ + VERBOSE=$(VERBOSE) \ ./test/run_tests.sh && make update-cache-images endif diff --git a/test/tests/01-package/run.sh b/test/tests/01-package/run.sh index be8bcc13..1d790c10 100644 --- a/test/tests/01-package/run.sh +++ b/test/tests/01-package/run.sh @@ -6,12 +6,41 @@ if \ [[ "$RESTY_IMAGE_BASE" == *'redhat'* ]] then major="${RESTY_IMAGE_TAG%%.*}" - docker run -d --name user-validation-tests --rm -e KONG_DATABASE=off -v $PWD:/src registry.access.redhat.com/ubi${major}/ubi tail -f /dev/null + IMAGE_BASE="registry.access.redhat.com/ubi${major}/ubi" else - docker rmi ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} --force - docker run -d --name user-validation-tests --rm -e KONG_DATABASE=off -v $PWD:/src ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} tail -f /dev/null + IMAGE_BASE="${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}" fi +# docker system call amd64 "x86_64" and arm64 "aarch64" +DOCKER_SYSTEM_ARCHITECTURE="$(docker system info --format '{{.Architecture}}')" + +# fall back on uname -m +DOCKER_SYSTEM_ARCHITECTURE="${DOCKER_SYSTEM_ARCHITECTURE:-$( + uname -m +)}" + +case "_${DOCKER_SYSTEM_ARCHITECTURE}" in + _aarch64|_arm64) + BASE_DOCKER_PLATFORM='linux/arm64/v8' + ;; + _x86_64|_amd64) + BASE_DOCKER_PLATFORM='linux/amd64' + ;; + _|_*) + # docker run allows this to be an empty string (aka default platform) + BASE_DOCKER_PLATFORM='' + ;; +esac + +docker run \ + -d \ + --name user-validation-tests \ + --rm \ + --platform "$BASE_DOCKER_PLATFORM" \ + -e KONG_DATABASE=off \ + -v "${PWD}:/src" \ + "$IMAGE_BASE" \ + tail -f /dev/null if [[ "$PACKAGE_TYPE" == "rpm" ]]; then cp $PACKAGE_LOCATION/*amd64.rpm kong.rpm docker exec ${USE_TTY} user-validation-tests /bin/bash -c "yum install -y /src/kong.rpm procps"