Skip to content

Commit c2589cb

Browse files
committed
Optimize envtest for slow CI runs
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 the 400+ 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. Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 15efd41 commit c2589cb

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

test/functional/base_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
const (
4444
SecretName = "external-secret"
4545
ContainerImage = "test://nova"
46-
timeout = 25 * time.Second
46+
timeout = 45 * time.Second
4747
// have maximum 100 retries before the timeout hits
4848
interval = timeout / 100
4949
// consistencyTimeout is the amount of time we use to repeatedly check

test/functional/suite_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ var _ = BeforeSuite(func() {
127127
keystoneCRDs,
128128
rabbitCRDs,
129129
},
130+
// Increase this to 60 or 120 seconds for the single-core run
131+
ControlPlaneStartTimeout: 120 * time.Second,
132+
// Give it plenty of time to wind down (e.g., 60-120 seconds)
133+
ControlPlaneStopTimeout: 120 * time.Second,
130134
CRDInstallOptions: envtest.CRDInstallOptions{
131135
Paths: []string{
132136
networkv1CRD,
@@ -140,6 +144,14 @@ var _ = BeforeSuite(func() {
140144
// failing on the colons in ::1
141145
LocalServingHost: "127.0.0.1",
142146
},
147+
ControlPlane: envtest.ControlPlane{
148+
APIServer: &envtest.APIServer{
149+
Args: []string{
150+
"--service-cluster-ip-range=10.0.0.0/12", // 65k+ IPs
151+
"--disable-admission-plugins=ResourceQuota,ServiceAccount,NamespaceLifecycle",
152+
},
153+
},
154+
},
143155
}
144156

145157
// cfg is defined in this file globally.

0 commit comments

Comments
 (0)