Skip to content

Commit f43feb8

Browse files
maiquebRamLavi
andcommitted
networking, virt: generalize conflict detection
This way we can ensure appropriate cases are caught in a generic way. With it, we can safely expect to find IP conflicts when there are duplicate IPs in the network. In future commits, we will be able to catch MAC conflicts when there are duplicate MACs in the network Co-authored-by: Ram Lavi <[email protected]> Signed-off-by: Miguel Duarte Barroso <[email protected]>
1 parent 2f8110a commit f43feb8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/extended/networking/livemigration.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,26 @@ func duplicateVM(cli *kubevirt.Client, vmNamespace, vmName string) {
570570
Expect(json.Unmarshal([]byte(originalVMIRawAnnotations), &originalVMIAnnotations)).To(Succeed())
571571

572572
var vmiCreationOptions []kubevirt.Option
573+
var vmiExpectations []func()
573574
if requestedIPs, hasIPRequests := originalVMIAnnotations[kvIPRequestsAnnot]; hasIPRequests {
574575
vmiCreationOptions = append(
575576
vmiCreationOptions,
576577
kubevirt.WithAnnotations(ipRequests(requestedIPs)),
577578
)
579+
vmiExpectations = append(vmiExpectations, func() {
580+
waitForVMPodEventWithMessage(
581+
cli,
582+
vmNamespace,
583+
duplicateVMName,
584+
"IP is already allocated",
585+
2*time.Minute,
586+
)
587+
})
578588
}
579589
Expect(cli.CreateVMIFromSpec(vmNamespace, duplicateVMName, vmiSpec, vmiCreationOptions...)).To(Succeed())
580-
waitForVMPodEventWithMessage(cli, vmNamespace, duplicateVMName, "IP is already allocated", 2*time.Minute)
590+
for _, expectation := range vmiExpectations {
591+
expectation()
592+
}
581593
}
582594

583595
func waitForVMPodEventWithMessage(vmClient *kubevirt.Client, vmNamespace, vmName, expectedEventMessage string, timeout time.Duration) {

0 commit comments

Comments
 (0)