@@ -946,6 +946,7 @@ func TestProcessPodMapper_WithLabelsAndUID(t *testing.T) {
946946}
947947
948948func TestBuildPodValueMap (t * testing.T ) {
949+ t .Parallel ()
949950 tests := []struct {
950951 name string
951952 pidToPod map [uint32 ]* PodInfo
@@ -960,6 +961,15 @@ func TestBuildPodValueMap(t *testing.T) {
960961 fieldName : metricGPUUtil ,
961962 expected : map [string ]string {},
962963 },
964+ {
965+ name : "empty pidToPod returns empty map" ,
966+ pidToPod : map [uint32 ]* PodInfo {},
967+ data : & perProcessMetrics {
968+ pidToSMUtil : map [uint32 ]uint32 {1001 : 50 },
969+ },
970+ fieldName : metricGPUUtil ,
971+ expected : map [string ]string {},
972+ },
963973 {
964974 name : "maps PID values to pod UIDs for GPU util" ,
965975 pidToPod : map [uint32 ]* PodInfo {1001 : {UID : "uid1" }, 1002 : {UID : "uid2" }},
@@ -991,13 +1001,15 @@ func TestBuildPodValueMap(t *testing.T) {
9911001
9921002 for _ , tc := range tests {
9931003 t .Run (tc .name , func (t * testing.T ) {
1004+ t .Parallel ()
9941005 result := buildPodValueMap (tc .pidToPod , tc .data , tc .fieldName )
9951006 assert .Equal (t , tc .expected , result )
9961007 })
9971008 }
9981009}
9991010
10001011func TestBuildIdlePodValues (t * testing.T ) {
1012+ t .Parallel ()
10011013 tests := []struct {
10021014 name string
10031015 existingValues map [string ]string
@@ -1026,13 +1038,15 @@ func TestBuildIdlePodValues(t *testing.T) {
10261038
10271039 for _ , tc := range tests {
10281040 t .Run (tc .name , func (t * testing.T ) {
1041+ t .Parallel ()
10291042 result := buildIdlePodValues (tc .existingValues , tc .devicePods )
10301043 assert .Equal (t , tc .expected , result )
10311044 })
10321045 }
10331046}
10341047
10351048func TestPodMapper_CreatePerProcessMetrics (t * testing.T ) {
1049+ t .Parallel ()
10361050 gpuUUID := "GPU-00000000-0000-0000-0000-000000000000"
10371051 podUID := "a9c80282-3f6b-4d5b-84d5-a137a6668011"
10381052
@@ -1226,6 +1240,7 @@ func TestPodMapper_CreatePerProcessMetrics(t *testing.T) {
12261240
12271241 for _ , tc := range tests {
12281242 t .Run (tc .name , func (t * testing.T ) {
1243+ t .Parallel ()
12291244 podMapper := & PodMapper {
12301245 Config : & appconfig.Config {
12311246 UseOldNamespace : tc .useOldNS ,
@@ -1245,21 +1260,17 @@ func TestPodMapper_CreatePerProcessMetrics(t *testing.T) {
12451260}
12461261
12471262func TestStripVGPUSuffix (t * testing.T ) {
1263+ t .Parallel ()
12481264 tests := []struct {
12491265 name string
12501266 deviceID string
12511267 expected string
12521268 }{
12531269 {
1254- name : "AWS MIG device ID with vgpu suffix" ,
1270+ name : "MIG device ID with vgpu suffix" ,
12551271 deviceID : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55::7" ,
12561272 expected : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55" ,
12571273 },
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- },
12631274 {
12641275 name : "Plain MIG UUID without suffix" ,
12651276 deviceID : "MIG-2ce7a541-c516-5dbc-a76e-26cc100d9b55" ,
@@ -1289,6 +1300,7 @@ func TestStripVGPUSuffix(t *testing.T) {
12891300
12901301 for _ , tc := range tests {
12911302 t .Run (tc .name , func (t * testing.T ) {
1303+ t .Parallel ()
12921304 result := stripVGPUSuffix (tc .deviceID )
12931305 assert .Equal (t , tc .expected , result )
12941306 })
0 commit comments