From ae90e6b9a1f1e9e7704feeefa8723c15f2afa61e Mon Sep 17 00:00:00 2001 From: Dinghua Li Date: Tue, 18 May 2021 21:13:24 +0000 Subject: [PATCH] Retain the test coverage of TestObserveWebhookRejection. --- .../k8s.io/apiserver/pkg/admission/metrics/metrics_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/admission/metrics/metrics_test.go b/staging/src/k8s.io/apiserver/pkg/admission/metrics/metrics_test.go index 1cddbcd89ee..6fe79cd1cd1 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/metrics/metrics_test.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/metrics/metrics_test.go @@ -96,7 +96,7 @@ func TestObserveWebhookRejection(t *testing.T) { Metrics.reset() Metrics.ObserveWebhookRejection(context.TODO(), "x", stepAdmit, attr, WebhookRejectionNoError, 500) Metrics.ObserveWebhookRejection(context.TODO(), "x", stepAdmit, attr, WebhookRejectionNoError, 654) - Metrics.ObserveWebhookRejection(context.TODO(), "x", stepValidate, attr, WebhookRejectionCallingWebhookError, 0) + Metrics.ObserveWebhookRejection(context.TODO(), "x", stepValidate, admission.NewAttributesRecord(nil, nil, kind, "ns", "name", resource, "subresource", admission.Update, &metav1.UpdateOptions{}, false, nil), WebhookRejectionCallingWebhookError, 0) wantLabels := map[string]string{ "name": "x", "operation": string(admission.Create), @@ -115,7 +115,7 @@ func TestObserveWebhookRejection(t *testing.T) { } wantLabelsCallingWebhookError := map[string]string{ "name": "x", - "operation": string(admission.Create), + "operation": string(admission.Update), "type": "validate", "error_type": "calling_webhook_error", "rejection_code": "0",