@@ -114,6 +114,7 @@ func TestFilterTerminatedContainerInfoAndAssembleByPodCgroupKey(t *testing.T) {
114
114
}
115
115
116
116
func TestCadvisorListPodStats (t * testing.T ) {
117
+ featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .KubeletPSI , true )
117
118
ctx := context .Background ()
118
119
const (
119
120
namespace0 = "test0"
@@ -295,12 +296,14 @@ func TestCadvisorListPodStats(t *testing.T) {
295
296
checkCPUStats (t , "Pod0Container0" , seedPod0Container0 , con .CPU )
296
297
checkMemoryStats (t , "Pod0Conainer0" , seedPod0Container0 , infos ["/pod0-c0" ], con .Memory )
297
298
checkSwapStats (t , "Pod0Conainer0" , seedPod0Container0 , infos ["/pod0-c0" ], con .Swap )
299
+ checkIOStats (t , "Pod0Conainer0" , seedPod0Container0 , infos ["/pod0-c0" ], con .IO )
298
300
299
301
con = indexCon [cName01 ]
300
302
assert .EqualValues (t , testTime (creationTime , seedPod0Container1 ).Unix (), con .StartTime .Time .Unix ())
301
303
checkCPUStats (t , "Pod0Container1" , seedPod0Container1 , con .CPU )
302
304
checkMemoryStats (t , "Pod0Container1" , seedPod0Container1 , infos ["/pod0-c1" ], con .Memory )
303
305
checkSwapStats (t , "Pod0Container1" , seedPod0Container1 , infos ["/pod0-c1" ], con .Swap )
306
+ checkIOStats (t , "Pod0Container1" , seedPod0Container1 , infos ["/pod0-c1" ], con .IO )
304
307
305
308
assert .EqualValues (t , p0Time .Unix (), ps .StartTime .Time .Unix ())
306
309
checkNetworkStats (t , "Pod0" , seedPod0Infra , ps .Network )
@@ -315,6 +318,9 @@ func TestCadvisorListPodStats(t *testing.T) {
315
318
checkSwapStats (t , "Pod0" , seedPod0Infra , infos ["/pod0-i" ], ps .Swap )
316
319
checkContainersSwapStats (t , ps , infos ["/pod0-c0" ], infos ["/pod0-c1" ])
317
320
}
321
+ if ps .IO != nil {
322
+ checkIOStats (t , "Pod0" , seedPod0Infra , infos ["/pod0-i" ], ps .IO )
323
+ }
318
324
319
325
// Validate Pod1 Results
320
326
ps , found = indexPods [prf1 ]
@@ -325,6 +331,7 @@ func TestCadvisorListPodStats(t *testing.T) {
325
331
checkCPUStats (t , "Pod1Container0" , seedPod1Container , con .CPU )
326
332
checkMemoryStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Memory )
327
333
checkSwapStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .Swap )
334
+ checkIOStats (t , "Pod1Container0" , seedPod1Container , infos ["/pod1-c0" ], con .IO )
328
335
checkNetworkStats (t , "Pod1" , seedPod1Infra , ps .Network )
329
336
checkContainersSwapStats (t , ps , infos ["/pod1-c0" ])
330
337
@@ -337,6 +344,7 @@ func TestCadvisorListPodStats(t *testing.T) {
337
344
checkCPUStats (t , "Pod2Container0" , seedPod2Container , con .CPU )
338
345
checkMemoryStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Memory )
339
346
checkSwapStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .Swap )
347
+ checkIOStats (t , "Pod2Container0" , seedPod2Container , infos ["/pod2-c0" ], con .IO )
340
348
checkNetworkStats (t , "Pod2" , seedPod2Infra , ps .Network )
341
349
checkContainersSwapStats (t , ps , infos ["/pod2-c0" ])
342
350
@@ -355,10 +363,12 @@ func TestCadvisorListPodStats(t *testing.T) {
355
363
checkCPUStats (t , "Pod3Container1" , seedPod3Container1 , con .CPU )
356
364
checkMemoryStats (t , "Pod3Container1" , seedPod3Container1 , infos ["/pod3-c1" ], con .Memory )
357
365
checkSwapStats (t , "Pod3Container1" , seedPod3Container1 , infos ["/pod3-c1" ], con .Swap )
366
+ checkIOStats (t , "Pod3Container1" , seedPod3Container1 , infos ["/pod3-c1" ], con .IO )
358
367
checkContainersSwapStats (t , ps , infos ["/pod3-c1" ])
359
368
}
360
369
361
370
func TestCadvisorListPodCPUAndMemoryStats (t * testing.T ) {
371
+ featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .KubeletPSI , true )
362
372
ctx := context .Background ()
363
373
const (
364
374
namespace0 = "test0"
@@ -476,6 +486,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
476
486
assert .Nil (t , con .Logs )
477
487
assert .Nil (t , con .Accelerators )
478
488
assert .Nil (t , con .UserDefinedMetrics )
489
+ assert .Nil (t , con .IO )
479
490
480
491
con = indexCon [cName01 ]
481
492
assert .EqualValues (t , testTime (creationTime , seedPod0Container1 ).Unix (), con .StartTime .Time .Unix ())
@@ -486,11 +497,13 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
486
497
assert .Nil (t , con .Logs )
487
498
assert .Nil (t , con .Accelerators )
488
499
assert .Nil (t , con .UserDefinedMetrics )
500
+ assert .Nil (t , con .IO )
489
501
490
502
assert .EqualValues (t , testTime (creationTime , seedPod0Infra ).Unix (), ps .StartTime .Time .Unix ())
491
503
assert .Nil (t , ps .EphemeralStorage )
492
504
assert .Nil (t , ps .VolumeStats )
493
505
assert .Nil (t , ps .Network )
506
+ assert .Nil (t , con .IO )
494
507
if ps .CPU != nil {
495
508
checkCPUStats (t , "Pod0" , seedPod0Infra , ps .CPU )
496
509
}
@@ -515,6 +528,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
515
528
assert .Nil (t , ps .EphemeralStorage )
516
529
assert .Nil (t , ps .VolumeStats )
517
530
assert .Nil (t , ps .Network )
531
+ assert .Nil (t , con .IO )
518
532
519
533
// Validate Pod2 Results
520
534
ps , found = indexPods [prf2 ]
@@ -529,6 +543,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
529
543
assert .Nil (t , ps .EphemeralStorage )
530
544
assert .Nil (t , ps .VolumeStats )
531
545
assert .Nil (t , ps .Network )
546
+ assert .Nil (t , con .IO )
532
547
}
533
548
534
549
func TestCadvisorImagesFsStatsKubeletSeparateDiskOff (t * testing.T ) {
0 commit comments