Skip to content

Commit

Permalink
local-setup: Remove local-setup-multi in favour of adding the cluster
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mikenairn committed Jul 31, 2024
1 parent d9bd07b commit 2ba6aca
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ;\

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<My managed zone name> TEST_DNS_NAMESPACES=<My test namesapace(s)>
make test-e2e TEST_DNS_MANAGED_ZONE_NAME=<My managed zone name> TEST_DNS_NAMESPACES=<My test namespace(s)>
```

| Environment Variable | Description |
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 11 additions & 10 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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=<unset> = dnsNamespaces=dns-operator
// dnsNamespaces=dns-operator-1,dns-operator-2 deploymentCount=<unset> = 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=<unset> configResult: dnsNamespaces=dns-operator
// inputs: TEST_DNS_NAMESPACES=dns-operator-1,dns-operator-2 DEPLOYMENT_COUNT=<unset> 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=<unset> = dnsClusterContexts=kind-kuadrant-dns-local
// dnsClusterContexts=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 clusterCount=<unset> = 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=<unset> configResult: dnsClusterContexts=kind-kuadrant-dns-local
// inputs: TEST_DNS_CLUSTER_CONTEXTS=kind-kuadrant-dns-local-1,kind-kuadrant-dns-local-2 CLUSTER_COUNT=<unset> 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
Expand Down

0 comments on commit 2ba6aca

Please sign in to comment.