Ensure webhook backend requests are not artificially rate-limited
This commit is contained in:
@@ -566,6 +566,9 @@ func testWebhookAdmission(t *testing.T, watchCache bool) {
|
||||
// Allow the webhook to establish
|
||||
time.Sleep(time.Second)
|
||||
|
||||
start := time.Now()
|
||||
count := 0
|
||||
|
||||
// Test admission on all resources, subresources, and verbs
|
||||
for _, gvr := range gvrsToTest {
|
||||
resource := resourcesByGVR[gvr]
|
||||
@@ -573,6 +576,7 @@ func testWebhookAdmission(t *testing.T, watchCache bool) {
|
||||
for _, verb := range []string{"create", "update", "patch", "connect", "delete", "deletecollection"} {
|
||||
if shouldTestResourceVerb(gvr, resource, verb) {
|
||||
t.Run(verb, func(t *testing.T) {
|
||||
count++
|
||||
holder.reset(t)
|
||||
testFunc := getTestFunc(gvr, verb)
|
||||
testFunc(&testContext{
|
||||
@@ -591,6 +595,12 @@ func testWebhookAdmission(t *testing.T, watchCache bool) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
duration := time.Now().Sub(start)
|
||||
perResourceDuration := time.Duration(int(duration) / count)
|
||||
if perResourceDuration >= 150*time.Millisecond {
|
||||
t.Errorf("expected resources to process in < 150ms, average was %v", perResourceDuration)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user