Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanderp3 committed Feb 13, 2024
1 parent 2035bb6 commit c7c9bc9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/webhooks/controlplanemachineset/webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,26 @@ var _ = Describe("Webhooks", func() {
var infra *configv1.Infrastructure
Context("on vSphere", func() {
Context("when validating without failure domains", func() {
infraOnEntry := configv1.Infrastructure{}
infraOnEntry := &configv1.Infrastructure{}
currentInfra := &configv1.Infrastructure{}
infraName := types.NamespacedName{
Name: "cluster",
}

BeforeEach(func() {
By("Configuring a vSphere infrastructure spec")
infra = configv1resourcebuilder.Infrastructure().AsVSphereWithFailureDomains("vsphere-test", nil).Build()
Expect(k8sClient.Get(ctx, infraName, &infraOnEntry)).To(Succeed())
Expect(k8sClient.Delete(ctx, &infraOnEntry)).To(Succeed())
Expect(k8sClient.Create(ctx, infra)).To(Succeed())

Expect(k8sClient.Get(ctx, infraName, currentInfra)).To(Succeed())
currentInfra.DeepCopyInto(infraOnEntry)

infra.Spec.DeepCopyInto(&currentInfra.Spec)
Expect(k8sClient.Update(ctx, currentInfra)).To(Succeed())
})

AfterEach(func() {
Expect(k8sClient.Delete(ctx, &infraOnEntry)).To(Succeed())
infraOnEntry.ResourceVersion = ""
Expect(k8sClient.Create(ctx, &infraOnEntry)).To(Succeed())
By("Restoring previous infrastructure spec")
infraOnEntry.Spec.DeepCopyInto(&currentInfra.Spec)
Expect(k8sClient.Update(ctx, currentInfra)).To(Succeed())
})

It("when providing invalid template in vSphere configuration", func() {
Expand Down

0 comments on commit c7c9bc9

Please sign in to comment.