From df27d5ac0439bf620de48dd92aa30f9bb856c604 Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Fri, 20 Sep 2024 17:47:16 +0100 Subject: [PATCH] Fix integration test. Signed-off-by: Jim Fitzpatrick --- controllers/state_of_the_world.go | 2 +- controllers/test_common.go | 8 +++++++- make/integration-tests.mk | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/controllers/state_of_the_world.go b/controllers/state_of_the_world.go index 8934ed4f6..1bb9d0fbb 100644 --- a/controllers/state_of_the_world.go +++ b/controllers/state_of_the_world.go @@ -29,7 +29,7 @@ import ( var ( ConfigMapGroupKind = schema.GroupKind{Group: corev1.GroupName, Kind: "ConfigMap"} - operatorNamespace = env.GetString("OPERATOR_NAMESPACE", "") + operatorNamespace = env.GetString("OPERATOR_NAMESPACE", "kuadrant-system") ) //+kubebuilder:rbac:groups=gateway.networking.k8s.io,resources=gatewayclasses,verbs=list;watch diff --git a/controllers/test_common.go b/controllers/test_common.go index 0819b2067..41bab5e64 100644 --- a/controllers/test_common.go +++ b/controllers/test_common.go @@ -34,6 +34,7 @@ import ( istiosecurityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" istioapis "istio.io/istio/operator/pkg/apis" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" @@ -256,9 +257,14 @@ func SetupKuadrantOperatorForTest(s *runtime.Scheme, cfg *rest.Config) { Expect(err).NotTo(HaveOccurred()) + dClient, err := dynamic.NewForConfig(mgr.GetConfig()) + Expect(err).NotTo(HaveOccurred()) + + stateOfTheWorld := NewPolicyMachineryController(mgr, dClient, log.Log) + go func() { defer GinkgoRecover() - err = mgr.Start(ctrl.SetupSignalHandler()) + err = stateOfTheWorld.Start(ctrl.SetupSignalHandler()) Expect(err).ToNot(HaveOccurred()) }() } diff --git a/make/integration-tests.mk b/make/integration-tests.mk index 0fe4db81e..51349d6b1 100644 --- a/make/integration-tests.mk +++ b/make/integration-tests.mk @@ -45,7 +45,7 @@ test-gatewayapi-env-integration: clean-cov generate fmt vet ginkgo ## Requires k test-istio-env-integration: clean-cov generate fmt vet ginkgo ## Requires kubernetes cluster with GatewayAPI and Istio installed. mkdir -p $(PROJECT_PATH)/coverage/istio-integration # Check `ginkgo help run` for command line options. For example to filtering tests. - GATEWAYAPI_PROVIDER=istio $(GINKGO) \ + GATEWAYAPI_PROVIDER=istio OPERATOR_NAMESPACE=kuadrant-system $(GINKGO) \ --coverpkg $(INTEGRATION_COVER_PKGS) \ --output-dir $(PROJECT_PATH)/coverage/istio-integration \ --coverprofile cover.out \ @@ -62,7 +62,7 @@ test-istio-env-integration: clean-cov generate fmt vet ginkgo ## Requires kubern test-envoygateway-env-integration: clean-cov generate fmt vet ginkgo ## Requires kubernetes cluster with GatewayAPI and EnvoyGateway installed. mkdir -p $(PROJECT_PATH)/coverage/envoygateway-integration # Check `ginkgo help run` for command line options. For example to filtering tests. - GATEWAYAPI_PROVIDER=envoygateway $(GINKGO) \ + GATEWAYAPI_PROVIDER=envoygateway OPERATOR_NAMESPACE=kuadrant-system $(GINKGO) \ --coverpkg $(INTEGRATION_COVER_PKGS) \ --output-dir $(PROJECT_PATH)/coverage/envoygateway-integration \ --coverprofile cover.out \ @@ -80,7 +80,7 @@ test-envoygateway-env-integration: clean-cov generate fmt vet ginkgo ## Requires test-integration: clean-cov generate fmt vet ginkgo ## Requires kubernetes cluster with at least one GatewayAPI provider installed. mkdir -p $(PROJECT_PATH)/coverage/integration # Check `ginkgo help run` for command line options. For example to filtering tests. - GATEWAYAPI_PROVIDER=$(GATEWAYAPI_PROVIDER) $(GINKGO) \ + GATEWAYAPI_PROVIDER=$(GATEWAYAPI_PROVIDER) OPERATOR_NAMESPACE=kuadrant-system $(GINKGO) \ --coverpkg $(INTEGRATION_COVER_PKGS) \ --output-dir $(PROJECT_PATH)/coverage/integration \ --coverprofile cover.out \