Skip to content

Commit

Permalink
Update webhook test for VM webhook update
Browse files Browse the repository at this point in the history
  • Loading branch information
rajivnathan committed Nov 22, 2024
1 parent 9f9588d commit 5467bf2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions testsupport/wait/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,28 @@ func (a *MemberAwaitility) verifyValidatingWebhookConfig(t *testing.T, ca []byte
assert.Equal(t, []string{"*"}, ssprequestRule.APIVersions)
assert.Equal(t, []string{"ssps"}, ssprequestRule.Resources)
assert.Equal(t, admv1.NamespacedScope, *ssprequestRule.Scope)

vmrequestWebhook := actualValWbhConf.Webhooks[3]
assert.Equal(t, "users.virtualmachines.validating.webhook.sandbox", vmrequestWebhook.Name)
assert.Equal(t, []string{"v1"}, vmrequestWebhook.AdmissionReviewVersions)
assert.Equal(t, admv1.SideEffectClassNone, *vmrequestWebhook.SideEffects)
assert.Equal(t, int32(5), *vmrequestWebhook.TimeoutSeconds)
assert.Equal(t, admv1.Fail, *vmrequestWebhook.FailurePolicy)
assert.Equal(t, admv1.Equivalent, *vmrequestWebhook.MatchPolicy)
assert.Equal(t, codereadyToolchainProviderLabel, vmrequestWebhook.NamespaceSelector.MatchLabels)
assert.Equal(t, ca, vmrequestWebhook.ClientConfig.CABundle)
assert.Equal(t, "member-operator-webhook", vmrequestWebhook.ClientConfig.Service.Name)
assert.Equal(t, a.Namespace, vmrequestWebhook.ClientConfig.Service.Namespace)
assert.Equal(t, "/validate-vmrequests", *vmrequestWebhook.ClientConfig.Service.Path)
assert.Equal(t, int32(443), *vmrequestWebhook.ClientConfig.Service.Port)
require.Len(t, vmrequestWebhook.Rules, 1)

vmrequestRule := vmrequestWebhook.Rules[0]
assert.Equal(t, []admv1.OperationType{admv1.Create, admv1.Update}, vmrequestRule.Operations)
assert.Equal(t, []string{"kubevirt.io"}, vmrequestRule.APIGroups)
assert.Equal(t, []string{"*"}, vmrequestRule.APIVersions)
assert.Equal(t, []string{"virtualmachines"}, vmrequestRule.Resources)
assert.Equal(t, admv1.NamespacedScope, *vmrequestRule.Scope)
}

func (a *MemberAwaitility) WaitForAutoscalingBufferApp(t *testing.T) {
Expand Down

0 comments on commit 5467bf2

Please sign in to comment.