mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	cadvisor_provider, unit test: Add swap stats to cadvisor CPU and Memory stats
Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
		@@ -467,6 +467,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
 | 
			
		||||
	assert.EqualValues(t, testTime(creationTime, seedPod0Container0).Unix(), con.StartTime.Time.Unix())
 | 
			
		||||
	checkCPUStats(t, "Pod0Container0", seedPod0Container0, con.CPU)
 | 
			
		||||
	checkMemoryStats(t, "Pod0Conainer0", seedPod0Container0, infos["/pod0-c0"], con.Memory)
 | 
			
		||||
	checkSwapStats(t, "Pod0Conainer0", seedPod0Container0, infos["/pod0-c0"], con.Swap)
 | 
			
		||||
	assert.Nil(t, con.Rootfs)
 | 
			
		||||
	assert.Nil(t, con.Logs)
 | 
			
		||||
	assert.Nil(t, con.Accelerators)
 | 
			
		||||
@@ -476,6 +477,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
 | 
			
		||||
	assert.EqualValues(t, testTime(creationTime, seedPod0Container1).Unix(), con.StartTime.Time.Unix())
 | 
			
		||||
	checkCPUStats(t, "Pod0Container1", seedPod0Container1, con.CPU)
 | 
			
		||||
	checkMemoryStats(t, "Pod0Container1", seedPod0Container1, infos["/pod0-c1"], con.Memory)
 | 
			
		||||
	checkSwapStats(t, "Pod0Container1", seedPod0Container1, infos["/pod0-c1"], con.Swap)
 | 
			
		||||
	assert.Nil(t, con.Rootfs)
 | 
			
		||||
	assert.Nil(t, con.Logs)
 | 
			
		||||
	assert.Nil(t, con.Accelerators)
 | 
			
		||||
@@ -491,6 +493,9 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
 | 
			
		||||
	if ps.Memory != nil {
 | 
			
		||||
		checkMemoryStats(t, "Pod0", seedPod0Infra, infos["/pod0-i"], ps.Memory)
 | 
			
		||||
	}
 | 
			
		||||
	if ps.Swap != nil {
 | 
			
		||||
		checkSwapStats(t, "Pod0", seedPod0Infra, infos["/pod0-i"], ps.Swap)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Validate Pod1 Results
 | 
			
		||||
	ps, found = indexPods[prf1]
 | 
			
		||||
@@ -500,6 +505,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
 | 
			
		||||
	assert.Equal(t, cName10, con.Name)
 | 
			
		||||
	checkCPUStats(t, "Pod1Container0", seedPod1Container, con.CPU)
 | 
			
		||||
	checkMemoryStats(t, "Pod1Container0", seedPod1Container, infos["/pod1-c0"], con.Memory)
 | 
			
		||||
	checkSwapStats(t, "Pod1Container0", seedPod1Container, infos["/pod1-c0"], con.Swap)
 | 
			
		||||
	assert.Nil(t, ps.EphemeralStorage)
 | 
			
		||||
	assert.Nil(t, ps.VolumeStats)
 | 
			
		||||
	assert.Nil(t, ps.Network)
 | 
			
		||||
@@ -512,6 +518,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
 | 
			
		||||
	assert.Equal(t, cName20, con.Name)
 | 
			
		||||
	checkCPUStats(t, "Pod2Container0", seedPod2Container, con.CPU)
 | 
			
		||||
	checkMemoryStats(t, "Pod2Container0", seedPod2Container, infos["/pod2-c0"], con.Memory)
 | 
			
		||||
	checkSwapStats(t, "Pod2Container0", seedPod2Container, infos["/pod2-c0"], con.Swap)
 | 
			
		||||
	assert.Nil(t, ps.EphemeralStorage)
 | 
			
		||||
	assert.Nil(t, ps.VolumeStats)
 | 
			
		||||
	assert.Nil(t, ps.Network)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user