@@ -365,7 +365,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
365
365
as .True (ok )
366
366
as .Equal (int64 (3 ), resource1Capacity .Value ())
367
367
as .Equal (int64 (2 ), resource1Allocatable .Value ())
368
- as .Equal ( 0 , len ( removedResources ) )
368
+ as .Empty ( removedResources )
369
369
370
370
// Deletes an unhealthy device should NOT change allocatable but change capacity.
371
371
devs1 := devs [:len (devs )- 1 ]
@@ -377,7 +377,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
377
377
as .True (ok )
378
378
as .Equal (int64 (2 ), resource1Capacity .Value ())
379
379
as .Equal (int64 (2 ), resource1Allocatable .Value ())
380
- as .Equal ( 0 , len ( removedResources ) )
380
+ as .Empty ( removedResources )
381
381
382
382
// Updates a healthy device to unhealthy should reduce allocatable by 1.
383
383
devs [1 ].Health = pluginapi .Unhealthy
@@ -389,7 +389,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
389
389
as .True (ok )
390
390
as .Equal (int64 (3 ), resource1Capacity .Value ())
391
391
as .Equal (int64 (1 ), resource1Allocatable .Value ())
392
- as .Equal ( 0 , len ( removedResources ) )
392
+ as .Empty ( removedResources )
393
393
394
394
// Deletes a healthy device should reduce capacity and allocatable by 1.
395
395
devs2 := devs [1 :]
@@ -401,7 +401,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
401
401
as .True (ok )
402
402
as .Equal (int64 (0 ), resource1Allocatable .Value ())
403
403
as .Equal (int64 (2 ), resource1Capacity .Value ())
404
- as .Equal ( 0 , len ( removedResources ) )
404
+ as .Empty ( removedResources )
405
405
406
406
// Tests adding another resource.
407
407
resourceName2 := "resource2"
@@ -410,14 +410,14 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
410
410
testManager .endpoints [resourceName2 ] = endpointInfo {e : e2 , opts : nil }
411
411
callback (resourceName2 , devs )
412
412
capacity , allocatable , removedResources = testManager .GetCapacity ()
413
- as .Equal ( 2 , len ( capacity ) )
413
+ as .Len ( capacity , 2 )
414
414
resource2Capacity , ok := capacity [v1 .ResourceName (resourceName2 )]
415
415
as .True (ok )
416
416
resource2Allocatable , ok := allocatable [v1 .ResourceName (resourceName2 )]
417
417
as .True (ok )
418
418
as .Equal (int64 (3 ), resource2Capacity .Value ())
419
419
as .Equal (int64 (1 ), resource2Allocatable .Value ())
420
- as .Equal ( 0 , len ( removedResources ) )
420
+ as .Empty ( removedResources )
421
421
422
422
// Expires resourceName1 endpoint. Verifies testManager.GetCapacity() reports that resourceName1
423
423
// is removed from capacity and it no longer exists in healthyDevices after the call.
@@ -432,7 +432,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
432
432
as .NotContains (testManager .healthyDevices , resourceName1 )
433
433
as .NotContains (testManager .unhealthyDevices , resourceName1 )
434
434
as .NotContains (testManager .endpoints , resourceName1 )
435
- as .Equal ( 1 , len ( testManager .endpoints ) )
435
+ as .Len ( testManager .endpoints , 1 )
436
436
437
437
// Stops resourceName2 endpoint. Verifies its stopTime is set, allocate and
438
438
// preStartContainer calls return errors.
@@ -464,7 +464,7 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
464
464
testManager .unhealthyDevices = make (map [string ]sets.Set [string ])
465
465
err = testManager .readCheckpoint ()
466
466
as .Nil (err )
467
- as .Equal ( 1 , len ( testManager .endpoints ) )
467
+ as .Len ( testManager .endpoints , 1 )
468
468
as .Contains (testManager .endpoints , resourceName2 )
469
469
capacity , allocatable , removed = testManager .GetCapacity ()
470
470
val , ok = capacity [v1 .ResourceName (resourceName2 )]
@@ -506,7 +506,7 @@ func TestGetAllocatableDevicesMultipleResources(t *testing.T) {
506
506
testManager .genericDeviceUpdateCallback (resourceName2 , resource2Devs )
507
507
508
508
allocatableDevs := testManager .GetAllocatableDevices ()
509
- as .Equal ( 2 , len ( allocatableDevs ) )
509
+ as .Len ( allocatableDevs , 2 )
510
510
511
511
devInstances1 , ok := allocatableDevs [resourceName1 ]
512
512
as .True (ok )
@@ -543,7 +543,7 @@ func TestGetAllocatableDevicesHealthTransition(t *testing.T) {
543
543
testManager .genericDeviceUpdateCallback (resourceName1 , resource1Devs )
544
544
545
545
allocatableDevs := testManager .GetAllocatableDevices ()
546
- as .Equal ( 1 , len ( allocatableDevs ) )
546
+ as .Len ( allocatableDevs , 1 )
547
547
devInstances , ok := allocatableDevs [resourceName1 ]
548
548
as .True (ok )
549
549
checkAllocatableDevicesConsistsOf (as , devInstances , []string {"R1Device1" , "R1Device2" })
@@ -557,7 +557,7 @@ func TestGetAllocatableDevicesHealthTransition(t *testing.T) {
557
557
testManager .genericDeviceUpdateCallback (resourceName1 , resource1Devs )
558
558
559
559
allocatableDevs = testManager .GetAllocatableDevices ()
560
- as .Equal ( 1 , len ( allocatableDevs ) )
560
+ as .Len ( allocatableDevs , 1 )
561
561
devInstances , ok = allocatableDevs [resourceName1 ]
562
562
as .True (ok )
563
563
checkAllocatableDevicesConsistsOf (as , devInstances , []string {"R1Device1" , "R1Device2" , "R1Device3" })
@@ -1293,9 +1293,9 @@ func TestGetDeviceRunContainerOptions(t *testing.T) {
1293
1293
// when pod is in activePods, GetDeviceRunContainerOptions should return
1294
1294
runContainerOpts , err := testManager .GetDeviceRunContainerOptions (pod1 , & pod1 .Spec .Containers [0 ])
1295
1295
as .Nil (err )
1296
- as .Equal ( len ( runContainerOpts .Devices ) , 3 )
1297
- as .Equal ( len ( runContainerOpts .Mounts ) , 2 )
1298
- as .Equal ( len ( runContainerOpts .Envs ) , 2 )
1296
+ as .Len ( runContainerOpts .Devices , 3 )
1297
+ as .Len ( runContainerOpts .Mounts , 2 )
1298
+ as .Len ( runContainerOpts .Envs , 2 )
1299
1299
1300
1300
activePods = []* v1.Pod {pod2 }
1301
1301
podsStub .updateActivePods (activePods )
@@ -1643,7 +1643,7 @@ func TestDevicePreStartContainer(t *testing.T) {
1643
1643
1644
1644
expectedResps , err := allocateStubFunc ()([]string {"dev1" , "dev2" })
1645
1645
as .Nil (err )
1646
- as .Equal ( 1 , len ( expectedResps .ContainerResponses ) )
1646
+ as .Len ( expectedResps .ContainerResponses , 1 )
1647
1647
expectedResp := expectedResps .ContainerResponses [0 ]
1648
1648
as .Equal (len (runContainerOpts .Devices ), len (expectedResp .Devices ))
1649
1649
as .Equal (len (runContainerOpts .Mounts ), len (expectedResp .Mounts ))
0 commit comments