From 129ee4e4f820fd2e21a9ecf8c3c2632e61692d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 23 May 2024 15:54:45 +0200 Subject: [PATCH] tests: run GatewayWithAttachedRoutes from Gateway API conformance suite (#286) --- Makefile | 20 ++++++++++++++----- .../gateway/controller_reconciler_utils.go | 6 ++++++ test/conformance/conformance_test.go | 2 -- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 60e4e973c..fa0faa05d 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,15 @@ SHELL = bash IMG ?= docker.io/kong/gateway-operator-oss KUSTOMIZE_IMG_NAME = docker.io/kong/gateway-operator-oss +ifeq (Darwin,$(shell uname -s)) +LDFLAGS_COMMON ?= -extldflags=-Wl,-ld_classic +endif + +LDFLAGS_METADATA ?= \ + -X $(REPO)/modules/manager/metadata.Release=$(TAG) \ + -X $(REPO)/modules/manager/metadata.Commit=$(COMMIT) \ + -X $(REPO)/modules/manager/metadata.Repo=$(REPO_INFO) + # ------------------------------------------------------------------------------ # Configuration - Tooling # ------------------------------------------------------------------------------ @@ -142,10 +151,8 @@ build.operator.debug: .PHONY: _build.operator _build.operator: - go build -o bin/manager $(GCFLAGS) -ldflags "$(LDFLAGS) \ - -X $(REPO)/modules/manager/metadata.Release=$(TAG) \ - -X $(REPO)/modules/manager/metadata.Commit=$(COMMIT) \ - -X $(REPO)/modules/manager/metadata.Repo=$(REPO_INFO)" \ + go build -o bin/manager $(GCFLAGS) \ + -ldflags "$(LDFLAGS_COMMON) $(LDFLAGS) $(LDFLAGS_METADATA)" \ cmd/main.go .PHONY: build @@ -315,6 +322,7 @@ _test.integration: webhook-certs-dir gotestsum GOTESTSUM_FORMAT=$(GOTESTSUM_FORMAT) \ $(GOTESTSUM) -- $(GOTESTFLAGS) \ -timeout $(INTEGRATION_TEST_TIMEOUT) \ + -ldflags "$(LDFLAGS_COMMON) $(LDFLAGS) $(LDFLAGS_METADATA)" \ -race \ -coverprofile=$(COVERPROFILE) \ ./test/integration/... @@ -343,6 +351,7 @@ test.integration_provision_dataplane_fail: _test.e2e: gotestsum GOTESTSUM_FORMAT=$(GOTESTSUM_FORMAT) \ $(GOTESTSUM) -- $(GOTESTFLAGS) \ + -ldflags "$(LDFLAGS_COMMON) $(LDFLAGS) $(LDFLAGS_METADATA)" \ -race \ ./test/e2e/... @@ -359,6 +368,7 @@ _test.conformance: gotestsum GOTESTSUM_FORMAT=$(GOTESTSUM_FORMAT) \ $(GOTESTSUM) -- $(GOTESTFLAGS) \ -timeout $(CONFORMANCE_TEST_TIMEOUT) \ + -ldflags "$(LDFLAGS_COMMON) $(LDFLAGS) $(LDFLAGS_METADATA)" \ -race \ -parallel $(PARALLEL) \ ./test/conformance/... @@ -368,7 +378,7 @@ test.conformance: @$(MAKE) _test.conformance \ KGO_PROJECT_URL=$(REPO) \ KGO_PROJECT_NAME=$(REPO_NAME) \ - KGO_RELEASE=$(TAG) + KGO_RELEASE=$(TAG) \ GOTESTFLAGS="$(GOTESTFLAGS)" .PHONY: test.samples diff --git a/controller/gateway/controller_reconciler_utils.go b/controller/gateway/controller_reconciler_utils.go index 193aa351f..ee3cef323 100644 --- a/controller/gateway/controller_reconciler_utils.go +++ b/controller/gateway/controller_reconciler_utils.go @@ -780,6 +780,12 @@ func (g *gatewayConditionsAndListenersAwareT) setProgrammed() { LastTransitionTime: metav1.Now(), } listenerStatus := listenerConditionsAware(listener) + rCond, ok := k8sutils.GetCondition(k8sutils.ConditionType(gatewayv1.ListenerConditionResolvedRefs), listenerStatus) + if ok && rCond.Status == metav1.ConditionFalse { + programmedCondition.Status = metav1.ConditionFalse + programmedCondition.Reason = string(gatewayv1.ListenerReasonPending) + programmedCondition.Message = "Listener references are not resolved yet." + } k8sutils.SetCondition(programmedCondition, listenerStatus) } } diff --git a/test/conformance/conformance_test.go b/test/conformance/conformance_test.go index f187d2271..7209c8616 100644 --- a/test/conformance/conformance_test.go +++ b/test/conformance/conformance_test.go @@ -24,8 +24,6 @@ var skippedTests = []string{ // gateway tests.GatewayInvalidTLSConfiguration.ShortName, tests.GatewayModifyListeners.ShortName, - // TODO: https://github.com/Kong/gateway-operator/issues/56 - tests.GatewayWithAttachedRoutes.ShortName, // httproute tests.HTTPRouteHeaderMatching.ShortName,