Skip to content

Commit

Permalink
pod mutator, unit tests: Fix flaky test
Browse files Browse the repository at this point in the history
Since the patches might appear in different order, we should use ConsistOf.

Signed-off-by: Or Shoval <[email protected]>
  • Loading branch information
oshoval committed Sep 22, 2024
1 parent 49ee8d7 commit 31e935d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/ipamclaimswebhook/podmutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ var _ = Describe("KubeVirt IPAM launcher pod mutato machine", Serial, func() {

ipamClaimsManager := NewIPAMClaimsValet(mgr)

Expect(
ipamClaimsManager.Handle(context.Background(), podAdmissionRequest(config.inputPod)),
).To(
Equal(config.expectedAdmissionResponse),
)
result := ipamClaimsManager.Handle(context.Background(), podAdmissionRequest(config.inputPod))

Expect(result.AdmissionResponse).To(Equal(config.expectedAdmissionResponse.AdmissionResponse))
Expect(result.Patches).To(ConsistOf(config.expectedAdmissionResponse.Patches))
},
Entry("pod not beloging to a VM and not requesting secondary "+
"attachments and no primary user defined network is accepted", testConfig{
Expand Down

0 comments on commit 31e935d

Please sign in to comment.