From 2ba6aca37e3dcf949a7b939c61801a4fcc0067d2 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Mon, 29 Jul 2024 11:06:29 +0100 Subject: [PATCH] local-setup: Remove local-setup-multi in favour of adding the cluster count option to local-setup ``` make local-setup DEPLOY=true CLUSTER_COUNT=2 ``` Only noticable change is that all clusters generated by local-setup, single or multi cluster, have a suffix for the count. ``` make local-setup DEPLOY=true kind get clusters kuadrant-dns-local-1 ``` Signed-off-by: Michael Nairn --- Makefile | 18 +++++++++--------- README.md | 2 +- test/e2e/README.md | 8 ++++---- test/e2e/suite_test.go | 21 +++++++++++---------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index e9ca4fa2..fdc3b95b 100644 --- a/Makefile +++ b/Makefile @@ -159,11 +159,11 @@ test-e2e: ginkgo test-e2e-multi: ginkgo $(GINKGO) -tags=e2e -v --label-filter=multi_record -v ./test/e2e -.PHONY: local-setup -local-setup: DEPLOY=false -local-setup: TEST_NAMESPACE=dnstest -local-setup: DEPLOYMENT_SCOPE=cluster -local-setup: $(KIND) ## Setup local development kind cluster, dependencies and optionally deploy the dns operator DEPLOY=false|true +.PHONY: local-setup-cluster +local-setup-cluster: DEPLOY=false +local-setup-cluster: TEST_NAMESPACE=dnstest +local-setup-cluster: DEPLOYMENT_SCOPE=cluster +local-setup-cluster: $(KIND) ## Setup local development kind cluster, dependencies and optionally deploy the dns operator DEPLOY=false|true @echo "local-setup: KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME} DEPLOY=${DEPLOY} DEPLOYMENT_SCOPE=${DEPLOYMENT_SCOPE} TEST_NAMESPACE=${TEST_NAMESPACE}" @$(MAKE) -s kind-delete-cluster @$(MAKE) -s kind-create-cluster @@ -188,11 +188,11 @@ local-setup: $(KIND) ## Setup local development kind cluster, dependencies and o $(KUBECTL) get managedzones -A @echo "local-setup: Complete!!" -.PHONY: local-setup-multi -local-setup-multi: CLUSTER_COUNT=1 -local-setup-multi: ## Setup multiple local development kind clusters +.PHONY: local-setup +local-setup: CLUSTER_COUNT=1 +local-setup: ## Setup local development kind cluster(s) @n=1 ; while [[ $$n -le $(CLUSTER_COUNT) ]] ; do \ - $(MAKE) -s local-setup KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME_PREFIX}-$$n;\ + $(MAKE) -s local-setup-cluster KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME_PREFIX}-$$n;\ ((n = n + 1)) ;\ done ;\ diff --git a/README.md b/README.md index 7dbe161b..3765c471 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ kubectl logs -f deployments/dns-operator-controller-manager -n dns-operator-syst The e2e test suite can be executed against any cluster running the DNS Operator with configuration added for any supported provider. ``` -make test-e2e TEST_DNS_MANAGED_ZONE_NAME= TEST_DNS_NAMESPACES= +make test-e2e TEST_DNS_MANAGED_ZONE_NAME= TEST_DNS_NAMESPACES= ``` | Environment Variable | Description | diff --git a/test/e2e/README.md b/test/e2e/README.md index 90b4f2b7..068ac848 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -43,16 +43,16 @@ dnstest dev-mz-gcp mn.google.hcpapps.net ### Cluster scoped on multiple clusters -Deploy the operator on two kind cluster each with one operator instance watching all namespaces: +Deploy the operator on two kind clusters each with one operator instance watching all namespaces: ```shell -make local-setup-multi DEPLOY=true CLUSTER_COUNT=2 +make local-setup DEPLOY=true CLUSTER_COUNT=2 ``` ### Namespace scoped on multiple clusters -Deploy the operator on two local kind cluster with two operator instances in two namespaces watching their own namespace only: +Deploy the operator on two local kind clusters with two operator instances in two namespaces watching their own namespace only: ```shell -make local-setup-multi DEPLOY=true DEPLOYMENT_SCOPE=namespace DEPLOYMENT_COUNT=2 CLUSTER_COUNT=2 +make local-setup DEPLOY=true DEPLOYMENT_SCOPE=namespace DEPLOYMENT_COUNT=2 CLUSTER_COUNT=2 ``` ## Run the test suite diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 9541c8f4..1875f40c 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -116,27 +116,28 @@ var _ = BeforeSuite(func(ctx SpecContext) { }) // setConfigFromEnvVars loads test suite runtime configurations from env vars. +// // dnsManagedZoneName managed zone name expected to exist in each test namespace (i.e. dev-mz-aws). // dnsNamespaces test namespaces, comma seperated list (i.e. dns-operator-1,dns-operator-2) // deploymentCount number of test namespaces expected. Appends an index suffix to the dnsNamespaces, only used if dnsNamespaces is a single length array. // // Examples: -// dnsNamespaces=dns-operator deploymentCount= = dnsNamespaces=dns-operator -// dnsNamespaces=dns-operator-1,dns-operator-2 deploymentCount= = dnsNamespaces=dns-operator-1,dns-operator-2 -// dnsNamespaces=dns-operator deploymentCount=1 = dnsNamespaces=dns-operator-1 -// dnsNamespaces=dns-operator deploymentCount=2 = dnsNamespaces=dns-operator-1,dns-operator-2 -// dnsNamespaces=dns-operator-5,dns-operator-6 deploymentCount=1 = dnsNamespaces=dns-operator-5,dns-operator-6 +// inputs: TEST_DNS_NAMESPACES=dns-operator DEPLOYMENT_COUNT= configResult: dnsNamespaces=dns-operator +// inputs: TEST_DNS_NAMESPACES=dns-operator-1,dns-operator-2 DEPLOYMENT_COUNT= configResult: dnsNamespaces=dns-operator-1,dns-operator-2 +// inputs: TEST_DNS_NAMESPACES=dns-operator DEPLOYMENT_COUNT=1 configResult: dnsNamespaces=dns-operator-1 +// inputs: TEST_DNS_NAMESPACES=dns-operator DEPLOYMENT_COUNT=2 configResult: dnsNamespaces=dns-operator-1,dns-operator-2 +// inputs: TEST_DNS_NAMESPACES=dns-operator-5,dns-operator-6 DEPLOYMENT_COUNT=1 configResult: dnsNamespaces=dns-operator-5,dns-operator-6 // // dnsClusterContexts test cluster contexts, comma seperated list (i.e. kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2), // if unset the current context is used and a single cluster is assumed. // clusterCount number of test clusters expected. Appends an index suffix to the dnsClusterContexts, only used if dnsClusterContexts is a single length array. // // Examples: -// dnsClusterContexts=kind-kuadrant-dns-local clusterCount= = dnsClusterContexts=kind-kuadrant-dns-local -// dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 clusterCount= = dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 -// dnsClusterContexts=kind-kuadrant-dns-local clusterCount=1 = dnsClusterContexts=kind-kuadrant-dns-local-1 -// dnsClusterContexts=kind-kuadrant-dns-local clusterCount=2 = dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 -// dnsClusterContexts=my-cluster-1,my-cluster-2 clusterCount=1 = dnsClusterContexts=my-cluster-1,my-cluster-2 +// inputs: TEST_DNS_CLUSTER_CONTEXTS=kind-kuadrant-dns-local CLUSTER_COUNT= configResult: dnsClusterContexts=kind-kuadrant-dns-local +// inputs: TEST_DNS_CLUSTER_CONTEXTS=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 CLUSTER_COUNT= configResult: dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 +// inputs: TEST_DNS_CLUSTER_CONTEXTS=kind-kuadrant-dns-local CLUSTER_COUNT=1 configResult: dnsClusterContexts=kind-kuadrant-dns-local-1 +// inputs: TEST_DNS_CLUSTER_CONTEXTS=kind-kuadrant-dns-local CLUSTER_COUNT=2 configResult: dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 +// inputs: TEST_DNS_CLUSTER_CONTEXTS=my-cluster-1,my-cluster-2 CLUSTER_COUNT=1 configResult: dnsClusterContexts=my-cluster-1,my-cluster-2 func setConfigFromEnvVars() error { // Load test suite configuration from the environment