@@ -411,27 +411,18 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
411
411
b .create (ctx , claim , pod )
412
412
413
413
// Waits for the ResourceClaim to be allocated and the pod to be scheduled.
414
- var allocatedResourceClaim * resourceapi.ResourceClaim
415
- var scheduledPod * v1.Pod
416
-
417
- gomega .Eventually (ctx , func (ctx context.Context ) (* resourceapi.ResourceClaim , error ) {
418
- var err error
419
- allocatedResourceClaim , err = b .f .ClientSet .ResourceV1beta1 ().ResourceClaims (b .f .Namespace .Name ).Get (ctx , claim .Name , metav1.GetOptions {})
420
- return allocatedResourceClaim , err
421
- }).WithTimeout (f .Timeouts .PodDelete ).ShouldNot (gomega .HaveField ("Status.Allocation" , (* resourceapi .AllocationResult )(nil )))
422
-
423
- gomega .Eventually (ctx , func (ctx context.Context ) error {
424
- var err error
425
- scheduledPod , err = b .f .ClientSet .CoreV1 ().Pods (pod .Namespace ).Get (ctx , pod .Name , metav1.GetOptions {})
426
- if err != nil && scheduledPod .Spec .NodeName != "" {
427
- return fmt .Errorf ("expected the test pod %s to exist and to be scheduled on a node: %w" , pod .Name , err )
428
- }
429
- return nil
430
- }).WithTimeout (f .Timeouts .PodDelete ).Should (gomega .BeNil ())
414
+ b .testPod (ctx , f , pod )
431
415
416
+ allocatedResourceClaim , err := b .f .ClientSet .ResourceV1beta1 ().ResourceClaims (b .f .Namespace .Name ).Get (ctx , claim .Name , metav1.GetOptions {})
417
+ framework .ExpectNoError (err )
418
+ gomega .Expect (allocatedResourceClaim ).ToNot (gomega .BeNil ())
432
419
gomega .Expect (allocatedResourceClaim .Status .Allocation ).ToNot (gomega .BeNil ())
433
420
gomega .Expect (allocatedResourceClaim .Status .Allocation .Devices .Results ).To (gomega .HaveLen (1 ))
434
421
422
+ scheduledPod , err := b .f .ClientSet .CoreV1 ().Pods (b .f .Namespace .Name ).Get (ctx , pod .Name , metav1.GetOptions {})
423
+ framework .ExpectNoError (err )
424
+ gomega .Expect (scheduledPod ).ToNot (gomega .BeNil ())
425
+
435
426
ginkgo .By ("Setting the device status a first time" )
436
427
allocatedResourceClaim .Status .Devices = append (allocatedResourceClaim .Status .Devices ,
437
428
resourceapi.AllocatedDeviceStatus {
@@ -446,8 +437,13 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
446
437
HardwareAddress : "bc:1c:b6:3e:b8:25" ,
447
438
},
448
439
})
440
+
449
441
// Updates the ResourceClaim from the driver on the same node as the pod.
450
- updatedResourceClaim , err := driver .Nodes [scheduledPod .Spec .NodeName ].ExamplePlugin .UpdateStatus (ctx , allocatedResourceClaim )
442
+ plugin , ok := driver .Nodes [scheduledPod .Spec .NodeName ]
443
+ if ! ok {
444
+ framework .Failf ("pod got scheduled to node %s without a plugin" , scheduledPod .Spec .NodeName )
445
+ }
446
+ updatedResourceClaim , err := plugin .UpdateStatus (ctx , allocatedResourceClaim )
451
447
framework .ExpectNoError (err )
452
448
gomega .Expect (updatedResourceClaim ).ToNot (gomega .BeNil ())
453
449
gomega .Expect (updatedResourceClaim .Status .Devices ).To (gomega .Equal (allocatedResourceClaim .Status .Devices ))
@@ -465,7 +461,8 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
465
461
HardwareAddress : "bc:1c:b6:3e:b8:26" ,
466
462
},
467
463
}
468
- updatedResourceClaim2 , err := driver .Nodes [scheduledPod .Spec .NodeName ].ExamplePlugin .UpdateStatus (ctx , updatedResourceClaim )
464
+
465
+ updatedResourceClaim2 , err := plugin .UpdateStatus (ctx , updatedResourceClaim )
469
466
framework .ExpectNoError (err )
470
467
gomega .Expect (updatedResourceClaim2 ).ToNot (gomega .BeNil ())
471
468
gomega .Expect (updatedResourceClaim2 .Status .Devices ).To (gomega .Equal (updatedResourceClaim .Status .Devices ))
0 commit comments