From cd9e810b622ad10b5dcdf8e3ee7f10111cebbc75 Mon Sep 17 00:00:00 2001 From: Travis Raines <571832+rainest@users.noreply.github.com> Date: Thu, 14 Mar 2024 11:36:45 -0700 Subject: [PATCH] chore: run standard DataPlane tests for BlueGreen (Kong/gateway-operator-archive#1619) * chore: run standard DataPlane tests for BlueGreen When running the BlueGreen integration tests, include standard DataPlane tests also. These should still function the same way with the BlueGreen controller, but may be broken by improper delegation. * fix: create delegate eventRecorder --- Makefile | 2 +- controllers/dataplane/bluegreen_controller.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 81e29d040..0ee9da656 100644 --- a/Makefile +++ b/Makefile @@ -320,7 +320,7 @@ test.integration: test.integration_bluegreen: @$(MAKE) _test.integration \ GATEWAY_OPERATOR_BLUEGREEN_CONTROLLER="true" \ - GOTESTFLAGS="-run=BlueGreen $(GOTESTFLAGS)" \ + GOTESTFLAGS="-run='BlueGreen|TestDataPlane' $(GOTESTFLAGS)" \ COVERPROFILE="coverage.integration-bluegreen.out" \ .PHONY: test.integration_provision_dataplane_fail diff --git a/controllers/dataplane/bluegreen_controller.go b/controllers/dataplane/bluegreen_controller.go index 4d0b59aa7..02252e50d 100644 --- a/controllers/dataplane/bluegreen_controller.go +++ b/controllers/dataplane/bluegreen_controller.go @@ -68,6 +68,11 @@ type BlueGreenReconciler struct { // SetupWithManager sets up the controller with the Manager. func (r *BlueGreenReconciler) SetupWithManager(mgr ctrl.Manager) error { + delegate, ok := r.DataPlaneController.(*Reconciler) + if !ok { + return fmt.Errorf("incorrect delegate controller type: %T", r.DataPlaneController) + } + delegate.eventRecorder = mgr.GetEventRecorderFor("dataplane") return DataPlaneWatchBuilder(mgr). Complete(r) }