@@ -57,10 +57,17 @@ func createTestPvcs(t *testing.T) *fake.Clientset {
57
57
volumeList = append (volumeList , * testVolume )
58
58
testPod := CreateTestPod (testNamespace , "test-pod" , "test-sa" , volumeList , AppLabels )
59
59
60
+ ephVolume := CreateEphemeralVolumeDefinition ("test-ephemeral-volume" , "1Gi" )
61
+ testPodWEphemeralStorage := CreateTestPod (testNamespace , "test-pod-ephemeral-storage" , "test-sa" , []corev1.Volume {* ephVolume }, AppLabels )
62
+
60
63
_ , err = clientset .CoreV1 ().Pods (testNamespace ).Create (context .TODO (), testPod , v1.CreateOptions {})
61
64
if err != nil {
62
65
t .Fatalf ("Error creating fake %s: %v" , "Pvc" , err )
63
66
}
67
+ _ , err = clientset .CoreV1 ().Pods (testNamespace ).Create (context .TODO (), testPodWEphemeralStorage , v1.CreateOptions {})
68
+ if err != nil {
69
+ t .Fatalf ("Error creating fake %s: %v" , "Pvc" , err )
70
+ }
64
71
65
72
return clientset
66
73
}
@@ -72,13 +79,17 @@ func TestRetrieveUsedPvcs(t *testing.T) {
72
79
t .Errorf ("Expected no error, got %v" , err )
73
80
}
74
81
75
- if len (usedPvcs ) != 1 {
76
- t .Errorf ("Expected 1 used pvc, got %d" , len (usedPvcs ))
82
+ if len (usedPvcs ) != 2 {
83
+ t .Errorf ("Expected 2 used pvc, got %d" , len (usedPvcs ))
77
84
}
78
85
79
86
if usedPvcs [0 ] != "test-pvc1" {
80
87
t .Errorf ("Expected 'test-pvc1', got %s" , usedPvcs [0 ])
81
88
}
89
+
90
+ if usedPvcs [1 ] != "test-pod-ephemeral-storage-test-ephemeral-volume" {
91
+ t .Errorf ("Expected 'test-pod-ephemeral-storage-test-ephemeral-volume', got %s" , usedPvcs [1 ])
92
+ }
82
93
}
83
94
84
95
func TestProcessNamespacePvcs (t * testing.T ) {
0 commit comments