diff --git a/tests/Makefile b/tests/Makefile index 81a8d42531..5ebbf7fbfb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,25 +1,27 @@ -SHELL=/bin/bash -ROOT_DIR = $(shell git rev-parse --show-toplevel) -CONTEXT = -PULL_POLICY = IfNotPresent -DEPLOYMENT_TYPE = deployment -IC_TYPE = nginx-ingress -SERVICE = nodeport -NODE_IP = -TEST_TAG = latest -TEST_PREFIX = test-runner -KUBE_CONFIG_FOLDER = ${HOME}/.kube +SHELL = /bin/bash +ROOT_DIR = $(shell git rev-parse --show-toplevel) +CONTEXT = +PULL_POLICY = IfNotPresent +DEPLOYMENT_TYPE = deployment +IC_TYPE = nginx-ingress +SERVICE = nodeport +NODE_IP = +TEST_PREFIX = test-runner +KUBE_CONFIG_FOLDER = ${HOME}/.kube KIND_KUBE_CONFIG_FOLDER = $(KUBE_CONFIG_FOLDER)/kind -SHOW_IC_LOGS = no -PYTEST_ARGS = -DOCKERFILEPATH := ${ROOT_DIR}/tests/Dockerfile -IP_FAMILY=dual -PREFIX ?= nginx/nginx-ingress ## The name of the image. For example, nginx/nginx-ingress -TAG ?= edge ## The tag of the image. For example, edge -K8S_CLUSTER_NAME ?= "local" ## The name used when creating/using a Kind Kubernetes cluster -K8S_CLUSTER_VERSION ?= $(shell grep -m1 'FROM kindest/node' < ${DOCKERFILEPATH} | cut -d ':' -f 2 | sed -e 's/^v//') ## The version used when creating a Kind Kubernetes cluster -K8S_TIMEOUT ?= 75s ## The timeout used when creating a Kind Kubernetes cluster -BUILD_IMAGE := $(PREFIX):$(TAG) +SHOW_IC_LOGS = no +PYTEST_ARGS = +DOCKERFILEPATH := ${ROOT_DIR}/tests/Dockerfile +IP_FAMILY = dual +TEST_TAG ?= latest ## The Tag to use for the test image. e.g. commitsha +PREFIX ?= nginx/nginx-ingress ## The name of the image. For example, nginx/nginx-ingress +TAG ?= edge ## The tag of the image. For example, edge +K8S_CLUSTER_NAME ?= local ## The name used when creating/using a Kind Kubernetes cluster +K8S_CLUSTER_VERSION ?= $(shell grep -m1 'FROM kindest/node' < ${DOCKERFILEPATH} | cut -d ':' -f 2 | sed -e 's/^v//') ## The version used when creating a Kind Kubernetes cluster +K8S_TIMEOUT ?= 75s ## The timeout used when creating a Kind Kubernetes cluster +AD_SECRET ?= +PYTEST_ARGS ?= +BUILD_IMAGE := $(strip $(PREFIX)):$(strip $(TAG)) .PHONY: help ## Show this help help: ## Show available make targets @@ -41,23 +43,23 @@ $(KIND_KUBE_CONFIG_FOLDER): $(KUBE_CONFIG_FOLDER) .PHONY: run-tests run-tests: ## Run tests - docker run --rm -v $(KUBE_CONFIG_FOLDER):/root/.kube $(PREFIX):$(TAG) --context=$(CONTEXT) --image=$(BUILD_IMAGE) --image-pull-policy=$(PULL_POLICY) --deployment-type=$(DEPLOYMENT_TYPE) --ic-type=$(IC_TYPE) --service=$(SERVICE) --node-ip=$(NODE_IP) --show-ic-logs=$(SHOW_IC_LOGS) $(PYTEST_ARGS) + docker run --rm -v $(KUBE_CONFIG_FOLDER):/root/.kube $(TEST_PREFIX):$(TEST_TAG) --context=$(CONTEXT) --image=$(BUILD_IMAGE) --image-pull-policy=$(PULL_POLICY) --deployment-type=$(DEPLOYMENT_TYPE) --ic-type=$(IC_TYPE) --service=$(SERVICE) --node-ip=$(NODE_IP) --show-ic-logs=$(SHOW_IC_LOGS) $(PYTEST_ARGS) .PHONY: update-test-kind-config ## Update Kind config update-test-kind-config: - sed -ir "s|server:.*|server: https://kind-control-plane:6443|" $(KIND_KUBE_CONFIG_FOLDER)/config + sed -ir "s|server:.*|server: https://$(strip $(K8S_CLUSTER_NAME))-control-plane:6443|" $(KIND_KUBE_CONFIG_FOLDER)/config .PHONY: run-tests-in-kind run-tests-in-kind: update-test-kind-config ## Run tests in Kind - docker run --network=kind --rm -v $(KIND_KUBE_CONFIG_FOLDER):/root/.kube $(PREFIX):$(TAG) \ - --context=kind-kind \ + docker run --network=kind --rm -v $(KIND_KUBE_CONFIG_FOLDER):/root/.kube $(TEST_PREFIX):$(TEST_TAG) \ + --context=kind-$(strip $(K8S_CLUSTER_NAME)) \ --image=$(BUILD_IMAGE) --image-pull-policy=$(PULL_POLICY) \ --deployment-type=$(DEPLOYMENT_TYPE) \ --ic-type=$(IC_TYPE) \ --service=nodeport \ - --node-ip=kind-control-plane \ + --node-ip=$(strip $(K8S_CLUSTER_NAME))-control-plane \ --show-ic-logs=$(SHOW_IC_LOGS) \ $(PYTEST_ARGS)