From 8055941bbfd7a58a51d03226c59e59696b94c81d Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 12 Feb 2026 11:13:59 +0100 Subject: [PATCH] Sync envtest optimization across all operators With recent changes to the CI env we hit issues running envtest hitting timeouts in test since 25s was not enough, but also during kube-api startup and register custom CRDs before checks start and teardown of the kube-api. Therefore adding ControlPlaneStartTimeout and ControlPlaneStopTimeout bumping the default 60s to 120s. Also hitting slow env and with our tests, we have seen that the default cluster ip range /24 is to small, increasing to /12 Also disable not required admission plugins for envtest: ResourceQuota: This stops the "quota evaluation timed out" error. The API server will no longer try to calculate how many resources exist before letting you create new ones. ServiceAccount: This prevents the API server from looking for a ServiceAccount issuer or secret for every pod/resource. Since envtest doesn't run the ServiceAccount controller, this plugin often just causes unnecessary errors or delays. NamespaceLifecycle: (Optional but recommended) This allows you to create resources in a namespace even if the namespace is in a "Terminating" state. This is very helpful when your cleanup is slow due to CPU throttling. Co-Authored-By: Claude Sonnet 4.5 Signed-off-by: Martin Schuppert --- test/functional/base_test.go | 2 +- test/functional/suite_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/functional/base_test.go b/test/functional/base_test.go index c645bc25..e3542e49 100644 --- a/test/functional/base_test.go +++ b/test/functional/base_test.go @@ -36,7 +36,7 @@ import ( ) const ( - timeout = 20 * time.Second + timeout = 45 * time.Second interval = 20 * time.Millisecond DatabaseHostname = "databasehost.example.org" DatabaseInstance = "openstack" diff --git a/test/functional/suite_test.go b/test/functional/suite_test.go index b47b8e51..69e74f5c 100644 --- a/test/functional/suite_test.go +++ b/test/functional/suite_test.go @@ -20,6 +20,7 @@ import ( "context" "path/filepath" "testing" + "time" "github.com/go-logr/logr" "github.com/google/uuid" @@ -111,6 +112,10 @@ var _ = BeforeSuite(func() { By("bootstrapping test environment") testEnv = &envtest.Environment{ + // Increase this to 60 or 120 seconds for the single-core run + ControlPlaneStartTimeout: 120 * time.Second, + // Give it plenty of time to wind down (e.g., 60-120 seconds) + ControlPlaneStopTimeout: 120 * time.Second, CRDDirectoryPaths: []string{ filepath.Join("..", "..", "config", "crd", "bases"), keystoneCRDs, @@ -126,6 +131,14 @@ var _ = BeforeSuite(func() { // failing on the colons in ::1 LocalServingHost: "127.0.0.1", }, + ControlPlane: envtest.ControlPlane{ + APIServer: &envtest.APIServer{ + Args: []string{ + "--service-cluster-ip-range=10.0.0.0/12", // 65k+ IPs + "--disable-admission-plugins=ResourceQuota,ServiceAccount,NamespaceLifecycle", + }, + }, + }, } // cfg is defined in this file globally.