@@ -69,6 +69,22 @@ E2E_IMG ?= quay.io/open-cluster-management/argocd-pull-integration:latest
6969
7070# #@ E2E Tests
7171
72+ .PHONY : setup-e2e-clusters
73+ setup-e2e-clusters : # # Setup KinD clusters, build and load controller image
74+ @echo " ===== Cleaning up existing clusters ====="
75+ $(KIND ) delete clusters --all || true
76+ @echo " "
77+ @echo " ===== Creating KinD clusters ====="
78+ $(KIND ) create cluster --name $(HUB_CLUSTER )
79+ $(KIND ) create cluster --name $(SPOKE_CLUSTER )
80+ @echo " "
81+ @echo " ===== Building controller image ====="
82+ $(MAKE ) docker-build IMG=$(E2E_IMG )
83+ @echo " "
84+ @echo " ===== Loading image to clusters ====="
85+ $(KIND ) load docker-image $(E2E_IMG ) --name $(HUB_CLUSTER )
86+ $(KIND ) load docker-image $(E2E_IMG ) --name $(SPOKE_CLUSTER )
87+
7288.PHONY : test-e2e
7389test-e2e : manifests generate fmt vet # # Run e2e deployment tests only (checks pods running and logs)
7490 @echo " ===== Installing MetalLB ====="
@@ -79,12 +95,10 @@ test-e2e: manifests generate fmt vet ## Run e2e deployment tests only (checks po
7995 @echo " "
8096 @echo " ===== Installing addon via Helm ====="
8197 $(KUBECTL ) config use-context kind-$(HUB_CLUSTER )
82- $(KUBECTL ) create namespace argocd || true
83- $(KUBECTL ) label namespace argocd app.kubernetes.io/managed-by=Helm --overwrite
84- $(KUBECTL ) annotate namespace argocd meta.helm.sh/release-name=argocd-agent-addon meta.helm.sh/release-namespace=argocd --overwrite
8598 helm install argocd-agent-addon \
8699 ./charts/argocd-agent-addon \
87100 --namespace argocd \
101+ --create-namespace \
88102 --set image=quay.io/open-cluster-management/argocd-pull-integration \
89103 --set tag=latest \
90104 --wait \
@@ -117,19 +131,7 @@ test-e2e-integration: ## Run full e2e integration tests including AppProject and
117131
118132.PHONY : test-e2e-full
119133test-e2e-full : # # Complete e2e test with kind cluster setup, build, deployment, and full integration tests
120- @echo " ===== Cleaning up existing clusters ====="
121- $(KIND ) delete clusters --all || true
122- @echo " "
123- @echo " ===== Creating KinD clusters ====="
124- $(KIND ) create cluster --name $(HUB_CLUSTER )
125- $(KIND ) create cluster --name $(SPOKE_CLUSTER )
126- @echo " "
127- @echo " ===== Building controller image ====="
128- $(MAKE ) docker-build IMG=$(E2E_IMG )
129- @echo " "
130- @echo " ===== Loading image to clusters ====="
131- $(KIND ) load docker-image $(E2E_IMG ) --name $(HUB_CLUSTER )
132- $(KIND ) load docker-image $(E2E_IMG ) --name $(SPOKE_CLUSTER )
134+ $(MAKE ) setup-e2e-clusters
133135 @echo " "
134136 @echo " ===== Running deployment tests ====="
135137 $(MAKE ) test-e2e
@@ -171,12 +173,10 @@ test-e2e-cleanup: manifests generate fmt vet ## Run e2e cleanup tests (checks ad
171173 @echo " "
172174 @echo " ===== Installing addon via Helm ====="
173175 $(KUBECTL ) config use-context kind-$(HUB_CLUSTER )
174- $(KUBECTL ) create namespace argocd || true
175- $(KUBECTL ) label namespace argocd app.kubernetes.io/managed-by=Helm --overwrite
176- $(KUBECTL ) annotate namespace argocd meta.helm.sh/release-name=argocd-agent-addon meta.helm.sh/release-namespace=argocd --overwrite
177176 helm install argocd-agent-addon \
178177 ./charts/argocd-agent-addon \
179178 --namespace argocd \
179+ --create-namespace \
180180 --set image=quay.io/open-cluster-management/argocd-pull-integration \
181181 --set tag=latest \
182182 --wait \
@@ -189,19 +189,7 @@ test-e2e-cleanup: manifests generate fmt vet ## Run e2e cleanup tests (checks ad
189189
190190.PHONY : test-e2e-cleanup-full
191191test-e2e-cleanup-full : # # Complete e2e test with cleanup verification including Application (cluster setup + deployment + cleanup)
192- @echo " ===== Cleaning up existing clusters ====="
193- $(KIND ) delete clusters --all || true
194- @echo " "
195- @echo " ===== Creating KinD clusters ====="
196- $(KIND ) create cluster --name $(HUB_CLUSTER )
197- $(KIND ) create cluster --name $(SPOKE_CLUSTER )
198- @echo " "
199- @echo " ===== Building controller image ====="
200- $(MAKE ) docker-build IMG=$(E2E_IMG )
201- @echo " "
202- @echo " ===== Loading image to clusters ====="
203- $(KIND ) load docker-image $(E2E_IMG ) --name $(HUB_CLUSTER )
204- $(KIND ) load docker-image $(E2E_IMG ) --name $(SPOKE_CLUSTER )
192+ $(MAKE ) setup-e2e-clusters
205193 @echo " "
206194 @echo " ===== Installing MetalLB ====="
207195 ./test/e2e/scripts/install_metallb.sh
@@ -211,12 +199,10 @@ test-e2e-cleanup-full: ## Complete e2e test with cleanup verification including
211199 @echo " "
212200 @echo " ===== Installing addon via Helm ====="
213201 $(KUBECTL ) config use-context kind-$(HUB_CLUSTER )
214- $(KUBECTL ) create namespace argocd || true
215- $(KUBECTL ) label namespace argocd app.kubernetes.io/managed-by=Helm --overwrite
216- $(KUBECTL ) annotate namespace argocd meta.helm.sh/release-name=argocd-agent-addon meta.helm.sh/release-namespace=argocd --overwrite
217202 helm install argocd-agent-addon \
218203 ./charts/argocd-agent-addon \
219204 --namespace argocd \
205+ --create-namespace \
220206 --set image=quay.io/open-cluster-management/argocd-pull-integration \
221207 --set tag=latest \
222208 --wait \
@@ -229,6 +215,42 @@ test-e2e-cleanup-full: ## Complete e2e test with cleanup verification including
229215 @echo " Hub context: kind-$( HUB_CLUSTER) "
230216 @echo " Spoke context: kind-$( SPOKE_CLUSTER) "
231217
218+ .PHONY : test-e2e-custom-namespace
219+ test-e2e-custom-namespace : manifests generate fmt vet # # Run e2e test with custom ArgoCD namespaces (hub: notargocd, spoke: argocdnot)
220+ @echo " ===== Installing MetalLB ====="
221+ ./test/e2e/scripts/install_metallb.sh
222+ @echo " "
223+ @echo " ===== Setting up OCM environment ====="
224+ ./test/e2e/scripts/setup_ocm_env.sh
225+ @echo " "
226+ @echo " ===== Installing addon via Helm with custom namespaces ====="
227+ $(KUBECTL ) config use-context kind-$(HUB_CLUSTER )
228+ helm install argocd-agent-addon \
229+ ./charts/argocd-agent-addon \
230+ --namespace notargocd \
231+ --create-namespace \
232+ --set global.argoCDNamespace=notargocd \
233+ --set global.argoCDOperatorNamespace=argocd-operator-system \
234+ --set controller.namespace=notargocd \
235+ --set gitOpsCluster.namespace=notargocd \
236+ --set image=quay.io/open-cluster-management/argocd-pull-integration \
237+ --set tag=latest \
238+ --wait \
239+ --timeout 10m
240+ @echo " "
241+ @echo " ===== Running e2e tests with custom namespaces ====="
242+ HUB_ARGOCD_NAMESPACE=notargocd go test -tags=e2e ./test/e2e/ -v -ginkgo.v --ginkgo.label-filter=" custom-namespace"
243+ @echo " "
244+ @echo " ===== E2E Custom Namespace Tests Complete ====="
245+ @echo " Hub context: kind-$( HUB_CLUSTER) (ArgoCD in notargocd namespace)"
246+ @echo " Spoke context: kind-$( SPOKE_CLUSTER) (ArgoCD in notargocd namespace)"
247+
248+ .PHONY : test-e2e-custom-namespace-full
249+ test-e2e-custom-namespace-full : # # Complete e2e test with custom namespaces (cluster setup + custom namespace deployment + tests)
250+ $(MAKE ) setup-e2e-clusters
251+ @echo " "
252+ $(MAKE ) test-e2e-custom-namespace
253+
232254# #@ Build
233255
234256.PHONY : build
0 commit comments