@@ -347,6 +347,9 @@ func TestProcessPodMapper_WithD_Different_Format_Of_DeviceID(t *testing.T) {
347347 ctrl := gomock .NewController (t )
348348 mockNVMLProvider := mocknvmlprovider .NewMockNVML (ctrl )
349349 mockNVMLProvider .EXPECT ().GetMIGDeviceInfoByID (gomock .Any ()).Return (migDeviceInfo , nil ).AnyTimes ()
350+ mockNVMLProvider .EXPECT ().GetDeviceProcessMemory (gomock .Any ()).Return (map [uint32 ]uint64 {}, nil ).AnyTimes ()
351+ mockNVMLProvider .EXPECT ().GetDeviceProcessUtilization (gomock .Any ()).Return (map [uint32 ]uint32 {}, nil ).AnyTimes ()
352+ mockNVMLProvider .EXPECT ().GetAllMIGDevicesProcessMemory (gomock .Any ()).Return (map [uint ]map [uint32 ]uint64 {}, nil ).AnyTimes ()
350353 nvmlprovider .SetClient (mockNVMLProvider )
351354
352355 podMapper := NewPodMapper (& appconfig.Config {
@@ -946,6 +949,7 @@ func TestProcessPodMapper_WithLabelsAndUID(t *testing.T) {
946949}
947950
948951func TestBuildPodValueMap (t * testing.T ) {
952+ t .Parallel ()
949953 tests := []struct {
950954 name string
951955 pidToPod map [uint32 ]* PodInfo
@@ -960,6 +964,15 @@ func TestBuildPodValueMap(t *testing.T) {
960964 fieldName : metricGPUUtil ,
961965 expected : map [string ]string {},
962966 },
967+ {
968+ name : "empty pidToPod returns empty map" ,
969+ pidToPod : map [uint32 ]* PodInfo {},
970+ data : & perProcessMetrics {
971+ pidToSMUtil : map [uint32 ]uint32 {1001 : 50 },
972+ },
973+ fieldName : metricGPUUtil ,
974+ expected : map [string ]string {},
975+ },
963976 {
964977 name : "maps PID values to pod UIDs for GPU util" ,
965978 pidToPod : map [uint32 ]* PodInfo {1001 : {UID : "uid1" }, 1002 : {UID : "uid2" }},
@@ -991,13 +1004,15 @@ func TestBuildPodValueMap(t *testing.T) {
9911004
9921005 for _ , tc := range tests {
9931006 t .Run (tc .name , func (t * testing.T ) {
1007+ t .Parallel ()
9941008 result := buildPodValueMap (tc .pidToPod , tc .data , tc .fieldName )
9951009 assert .Equal (t , tc .expected , result )
9961010 })
9971011 }
9981012}
9991013
10001014func TestBuildIdlePodValues (t * testing.T ) {
1015+ t .Parallel ()
10011016 tests := []struct {
10021017 name string
10031018 existingValues map [string ]string
@@ -1026,13 +1041,15 @@ func TestBuildIdlePodValues(t *testing.T) {
10261041
10271042 for _ , tc := range tests {
10281043 t .Run (tc .name , func (t * testing.T ) {
1044+ t .Parallel ()
10291045 result := buildIdlePodValues (tc .existingValues , tc .devicePods )
10301046 assert .Equal (t , tc .expected , result )
10311047 })
10321048 }
10331049}
10341050
10351051func TestPodMapper_CreatePerProcessMetrics (t * testing.T ) {
1052+ t .Parallel ()
10361053 gpuUUID := "GPU-00000000-0000-0000-0000-000000000000"
10371054 podUID := "a9c80282-3f6b-4d5b-84d5-a137a6668011"
10381055
@@ -1226,6 +1243,7 @@ func TestPodMapper_CreatePerProcessMetrics(t *testing.T) {
12261243
12271244 for _ , tc := range tests {
12281245 t .Run (tc .name , func (t * testing.T ) {
1246+ t .Parallel ()
12291247 podMapper := & PodMapper {
12301248 Config : & appconfig.Config {
12311249 UseOldNamespace : tc .useOldNS ,
@@ -1245,21 +1263,17 @@ func TestPodMapper_CreatePerProcessMetrics(t *testing.T) {
12451263}
12461264
12471265func TestStripVGPUSuffix (t * testing.T ) {
1266+ t .Parallel ()
12481267 tests := []struct {
12491268 name string
12501269 deviceID string
12511270 expected string
12521271 }{
12531272 {
1254- name : "AWS MIG device ID with vgpu suffix" ,
1273+ name : "MIG device ID with vgpu suffix" ,
12551274 deviceID : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55::7" ,
12561275 expected : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55" ,
12571276 },
1258- {
1259- name : "AWS MIG device ID with different vgpu index" ,
1260- deviceID : "MIG-a8d7e63b-588b-5fd8-826d-d1eab19c6f18::9" ,
1261- expected : "MIG-a8d7e63b-588b-5fd8-826d-d1eab19c6f18" ,
1262- },
12631277 {
12641278 name : "Plain MIG UUID without suffix" ,
12651279 deviceID : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55" ,
@@ -1289,6 +1303,7 @@ func TestStripVGPUSuffix(t *testing.T) {
12891303
12901304 for _ , tc := range tests {
12911305 t .Run (tc .name , func (t * testing.T ) {
1306+ t .Parallel ()
12921307 result := stripVGPUSuffix (tc .deviceID )
12931308 assert .Equal (t , tc .expected , result )
12941309 })
0 commit comments