MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / AssertWebhookEnabled

Function AssertWebhookEnabled

tests/e2e/webhook_test.go:141–157  ·  view source on GitHub ↗
(env *environment.TestingEnvironment, mutating, validating string)

Source from the content-addressed store, hash-verified

139})
140
141func AssertWebhookEnabled(env *environment.TestingEnvironment, mutating, validating string) {
142 By("re-setting namespace selector for all admission controllers", func() {
143 // Setting the namespace selector in MutatingWebhook and ValidatingWebhook
144 // to nil will go back to the default behaviour
145 mWhc, position, err := operator.GetMutatingWebhookByName(env.Ctx, env.Client, mutating)
146 Expect(err).ToNot(HaveOccurred())
147 mWhc.Webhooks[position].NamespaceSelector = nil
148 err = operator.UpdateMutatingWebhookConf(env.Ctx, env.Interface, mWhc)
149 Expect(err).ToNot(HaveOccurred())
150
151 vWhc, position, err := operator.GetValidatingWebhookByName(env.Ctx, env.Client, validating)
152 Expect(err).ToNot(HaveOccurred())
153 vWhc.Webhooks[position].NamespaceSelector = nil
154 err = operator.UpdateValidatingWebhookConf(env.Ctx, env.Interface, vWhc)
155 Expect(err).ToNot(HaveOccurred())
156 })
157}

Callers 1

webhook_test.goFile · 0.85

Calls 4

GetMutatingWebhookByNameFunction · 0.92

Tested by

no test coverage detected