bug: If one type of webhook is not defined, testenv.Build hits a nil dereference
The nil dereference happens here:
@@ -170,9 +170,15 @@ func (t *TestEnvironmentConfiguration) Build() (*TestEnvironment, error) {
if err != nil {
return nil, err
}
+ if m != nil {
+ // No mutating webhook defined.
mutatingWebhooks = append(mutatingWebhooks, m)
+ }
+ if v != nil {
+ // No validating webhook defined.
validatingWebhooks = append(mutatingWebhooks, v)
}
+ }
t.env.WebhookInstallOptions = envtest.WebhookInstallOptions{
MaxTime: 20 * time.Second,
