@@ -313,6 +313,7 @@ func TestCadvisorListPodStats(t *testing.T) {
313
313
}
314
314
if ps .Swap != nil {
315
315
checkSwapStats (t , "Pod0" , seedPod0Infra , infos ["/pod0-i" ], ps .Swap )
316
+ checkContainersSwapStats (t , ps , infos ["/pod0-c0" ], infos ["/pod0-c1" ])
316
317
}
317
318
318
319
// Validate Pod1 Results
@@ -325,6 +326,7 @@ func TestCadvisorListPodStats(t *testing.T) {
325
326
checkMemoryStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Memory )
326
327
checkSwapStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Swap )
327
328
checkNetworkStats (t , "Pod1" , seedPod1Infra , ps .Network )
329
+ checkContainersSwapStats (t , ps , infos ["/pod1-c0" ])
328
330
329
331
// Validate Pod2 Results
330
332
ps , found = indexPods [prf2 ]
@@ -336,6 +338,7 @@ func TestCadvisorListPodStats(t *testing.T) {
336
338
checkMemoryStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Memory )
337
339
checkSwapStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Swap )
338
340
checkNetworkStats (t , "Pod2" , seedPod2Infra , ps .Network )
341
+ checkContainersSwapStats (t , ps , infos ["/pod2-c0" ])
339
342
340
343
// Validate Pod3 Results
341
344
@@ -352,6 +355,7 @@ func TestCadvisorListPodStats(t *testing.T) {
352
355
checkCPUStats (t , "Pod3Container1" , seedPod3Container1 , con .CPU )
353
356
checkMemoryStats (t , "Pod3Container1" , seedPod3Container1 , infos ["/pod3-c1" ], con .Memory )
354
357
checkSwapStats (t , "Pod3Container1" , seedPod3Container1 , infos ["/pod3-c1" ], con .Swap )
358
+ checkContainersSwapStats (t , ps , infos ["/pod3-c1" ])
355
359
}
356
360
357
361
func TestCadvisorListPodCPUAndMemoryStats (t * testing.T ) {
@@ -467,6 +471,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
467
471
assert .EqualValues (t , testTime (creationTime , seedPod0Container0 ).Unix (), con .StartTime .Time .Unix ())
468
472
checkCPUStats (t , "Pod0Container0" , seedPod0Container0 , con .CPU )
469
473
checkMemoryStats (t , "Pod0Conainer0" , seedPod0Container0 , infos ["/pod0-c0" ], con .Memory )
474
+ checkSwapStats (t , "Pod0Conainer0" , seedPod0Container0 , infos ["/pod0-c0" ], con .Swap )
470
475
assert .Nil (t , con .Rootfs )
471
476
assert .Nil (t , con .Logs )
472
477
assert .Nil (t , con .Accelerators )
@@ -476,6 +481,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
476
481
assert .EqualValues (t , testTime (creationTime , seedPod0Container1 ).Unix (), con .StartTime .Time .Unix ())
477
482
checkCPUStats (t , "Pod0Container1" , seedPod0Container1 , con .CPU )
478
483
checkMemoryStats (t , "Pod0Container1" , seedPod0Container1 , infos ["/pod0-c1" ], con .Memory )
484
+ checkSwapStats (t , "Pod0Container1" , seedPod0Container1 , infos ["/pod0-c1" ], con .Swap )
479
485
assert .Nil (t , con .Rootfs )
480
486
assert .Nil (t , con .Logs )
481
487
assert .Nil (t , con .Accelerators )
@@ -491,6 +497,10 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
491
497
if ps .Memory != nil {
492
498
checkMemoryStats (t , "Pod0" , seedPod0Infra , infos ["/pod0-i" ], ps .Memory )
493
499
}
500
+ if ps .Swap != nil {
501
+ checkSwapStats (t , "Pod0" , seedPod0Infra , infos ["/pod0-i" ], ps .Swap )
502
+ checkContainersSwapStats (t , ps , infos ["/pod0-c0" ], infos ["/pod0-c1" ])
503
+ }
494
504
495
505
// Validate Pod1 Results
496
506
ps , found = indexPods [prf1 ]
@@ -500,6 +510,8 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
500
510
assert .Equal (t , cName10 , con .Name )
501
511
checkCPUStats (t , "Pod1Container0" , seedPod1Container , con .CPU )
502
512
checkMemoryStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Memory )
513
+ checkSwapStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Swap )
514
+ checkContainersSwapStats (t , ps , infos ["/pod1-c0" ])
503
515
assert .Nil (t , ps .EphemeralStorage )
504
516
assert .Nil (t , ps .VolumeStats )
505
517
assert .Nil (t , ps .Network )
@@ -512,6 +524,8 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
512
524
assert .Equal (t , cName20 , con .Name )
513
525
checkCPUStats (t , "Pod2Container0" , seedPod2Container , con .CPU )
514
526
checkMemoryStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Memory )
527
+ checkSwapStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Swap )
528
+ checkContainersSwapStats (t , ps , infos ["/pod2-c0" ])
515
529
assert .Nil (t , ps .EphemeralStorage )
516
530
assert .Nil (t , ps .VolumeStats )
517
531
assert .Nil (t , ps .Network )
0 commit comments