Skip to content

Commit 4c1ec6b

Browse files
AlinsRanCopilot
andcommitted
fix: resolve lint issues in webhook e2e tests and consumer webhook
- Remove unused messageSubstrings variadic parameter from expectAdmissionDenied - Add nolint:dupl to warn-on-missing It blocks (structurally similar but different YAML) - Fix gofmt trailing newline in consumer_webhook.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4ffeb5e commit 4c1ec6b

4 files changed

Lines changed: 3 additions & 7 deletions

File tree

internal/webhook/v1/consumer_webhook.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,3 @@ func (v *ConsumerCustomValidator) extractCredentialKey(ctx context.Context, cons
239239
}
240240
return cfg.Key, nil
241241
}
242-

test/e2e/webhook/apisixconsumer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var _ = Describe("Test ApisixConsumer Webhook", Label("webhook"), func() {
4747
time.Sleep(5 * time.Second)
4848
})
4949

50-
It("should warn on missing authentication secrets", func() {
50+
It("should warn on missing authentication secrets", func() { //nolint:dupl
5151
missingSecret := "missing-basic-secret"
5252
consumerName := "webhook-apisixconsumer"
5353
consumerYAML := `

test/e2e/webhook/apisixroute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var _ = Describe("Test ApisixRoute Webhook", Label("webhook"), func() {
4646
time.Sleep(5 * time.Second)
4747
})
4848

49-
It("should warn on missing service references", func() {
49+
It("should warn on missing service references", func() { //nolint:dupl
5050
missingService := "missing-backend"
5151
routeName := "webhook-apisixroute"
5252
routeYAML := `

test/e2e/webhook/helpers.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,9 @@ spec:
236236
Expect(output).NotTo(ContainSubstring(missingBackendWarning))
237237
}
238238

239-
func expectAdmissionDenied(s *scaffold.Scaffold, resourceType, resourceName string, err error, messageSubstrings ...string) {
239+
func expectAdmissionDenied(s *scaffold.Scaffold, resourceType, resourceName string, err error) {
240240
Expect(err).To(HaveOccurred(), "expecting admission rejection")
241241
Expect(err.Error()).To(ContainSubstring("denied the request"))
242-
for _, substring := range messageSubstrings {
243-
Expect(err.Error()).To(ContainSubstring(substring))
244-
}
245242

246243
_, getErr := s.GetOutputFromString(resourceType, resourceName, "-o", "yaml")
247244
Expect(getErr).To(HaveOccurred(), fmt.Sprintf("resource %s/%s should not exist after admission rejection", resourceType, resourceName))

0 commit comments

Comments
 (0)