@@ -347,12 +347,18 @@ var _ = Describe("Daemon Controller", Ordered, func() {
347347 err := k8sClient .Update (ctx , nodeState )
348348 Expect (err ).ToNot (HaveOccurred ())
349349
350+ nodeState = & sriovnetworkv1.SriovNetworkNodeState {ObjectMeta : metav1.ObjectMeta {Name : nodeName , Namespace : testNamespace }}
350351 eventuallySyncStatusEqual (nodeState , constants .SyncStatusSucceeded )
351352
352353 By ("Simulate node policy removal" )
353- nodeState .Spec .Interfaces = []sriovnetworkv1.Interface {}
354- err = k8sClient .Update (ctx , nodeState )
355- Expect (err ).ToNot (HaveOccurred ())
354+ EventuallyWithOffset (1 , func (g Gomega ) {
355+ err := k8sClient .Get (ctx , types.NamespacedName {Namespace : nodeState .Namespace , Name : nodeState .Name }, nodeState )
356+ g .Expect (err ).ToNot (HaveOccurred ())
357+
358+ nodeState .Spec .Interfaces = []sriovnetworkv1.Interface {}
359+ err = k8sClient .Update (ctx , nodeState )
360+ g .Expect (err ).ToNot (HaveOccurred ())
361+ }, waitTime , retryTime ).Should (Succeed ())
356362
357363 eventuallySyncStatusEqual (nodeState , constants .SyncStatusSucceeded )
358364 assertLastStatusTransitionsContains (nodeState , 2 , constants .SyncStatusInProgress )
@@ -361,7 +367,6 @@ var _ = Describe("Daemon Controller", Ordered, func() {
361367 It ("Should apply external drainer annotation when useExternalDrainer is true" , func (ctx context.Context ) {
362368 DeferCleanup (func (x bool ) { vars .UseExternalDrainer = x }, vars .UseExternalDrainer )
363369 vars .UseExternalDrainer = true
364-
365370 discoverSriovReturn .Store (& []sriovnetworkv1.InterfaceExt {
366371 {
367372 Name : "eno1" ,
@@ -375,16 +380,47 @@ var _ = Describe("Daemon Controller", Ordered, func() {
375380 LinkType : "ETH" ,
376381 Mac : "aa:bb:cc:dd:ee:ff" ,
377382 Mtu : 1500 ,
378- TotalVfs : 2 ,
379- NumVfs : 0 ,
383+ TotalVfs : 3 ,
384+ NumVfs : 3 ,
385+ VFs : []sriovnetworkv1.VirtualFunction {
386+ {
387+ Name : "eno1f0" ,
388+ PciAddress : "0000:16:00.1" ,
389+ VfID : 0 ,
390+ },
391+ {
392+ Name : "eno1f1" ,
393+ PciAddress : "0000:16:00.2" ,
394+ VfID : 1 ,
395+ },
396+ {
397+ Name : "eno1f2" ,
398+ PciAddress : "0000:16:00.3" ,
399+ VfID : 2 ,
400+ },
401+ },
380402 },
381403 })
382404
383- By ("waiting for state to be in progress" )
384- eventuallySyncStatusEqual (nodeState , constants .SyncStatusInProgress )
385-
386- err := k8sClient .Get (ctx , types.NamespacedName {Namespace : nodeState .Namespace , Name : nodeState .Name }, nodeState )
387- Expect (err ).ToNot (HaveOccurred ())
405+ EventuallyWithOffset (1 , func (g Gomega ) {
406+ err := k8sClient .Get (ctx , types.NamespacedName {Namespace : nodeState .Namespace , Name : nodeState .Name }, nodeState )
407+ g .Expect (err ).ToNot (HaveOccurred ())
408+
409+ nodeState .Spec .Interfaces = []sriovnetworkv1.Interface {
410+ {Name : "eno1" ,
411+ PciAddress : "0000:16:00.0" ,
412+ LinkType : "eth" ,
413+ NumVfs : 3 ,
414+ VfGroups : []sriovnetworkv1.VfGroup {
415+ {ResourceName : "test" ,
416+ DeviceType : "netdevice" ,
417+ PolicyName : "test-policy" ,
418+ VfRange : "0-2" },
419+ }},
420+ }
421+ err = k8sClient .Update (ctx , nodeState )
422+ g .Expect (err ).ToNot (HaveOccurred ())
423+ }, waitTime , retryTime ).Should (Succeed ())
388424
389425 By ("waiting to require drain" )
390426 EventuallyWithOffset (1 , func (g Gomega ) {
0 commit comments