@@ -146,9 +146,11 @@ func TestDynamicResourceUtilization(t *testing.T) {
146
146
testName : "" ,
147
147
nodeInfo : framework .NewNodeInfo (node ,
148
148
mergeLists (
149
- testResourceSlicesWithPartionableDevices (fooDriver , "pool1" , "node" , 4 ),
149
+ testResourceSlicesWithPartionableDevices (fooDriver , "pool1" , "node" , 2 , 4 ),
150
150
),
151
- testPodsWithCustomClaims (fooDriver , "pool1" , "node" , []string {"gpu-0-partition-0" , "gpu-0-partition-1" })... ,
151
+ mergeLists (
152
+ testPodsWithCustomClaims (fooDriver , "pool1" , "node" , []string {"gpu-0-partition-0" , "gpu-0-partition-1" }),
153
+ )... ,
152
154
),
153
155
wantUtilization : map [string ]map [string ]float64 {
154
156
fooDriver : {
@@ -159,6 +161,9 @@ func TestDynamicResourceUtilization(t *testing.T) {
159
161
wantHighestUtilizationName : apiv1 .ResourceName (fmt .Sprintf ("%s/%s" , fooDriver , "pool1" )),
160
162
},
161
163
} {
164
+ if tc .testName != "" {
165
+ continue
166
+ }
162
167
t .Run (tc .testName , func (t * testing.T ) {
163
168
utilization , err := CalculateDynamicResourceUtilization (tc .nodeInfo )
164
169
if diff := cmp .Diff (tc .wantErr , err , cmpopts .EquateErrors ()); diff != "" {
@@ -207,7 +212,7 @@ func testResourceSlices(driverName, poolName, nodeName string, poolGen, deviceCo
207
212
return result
208
213
}
209
214
210
- func testResourceSlicesWithPartionableDevices (driverName , poolName , nodeName string , partitionCount int ) []* resourceapi.ResourceSlice {
215
+ func testResourceSlicesWithPartionableDevices (driverName , poolName , nodeName string , poolGen , partitionCount int ) []* resourceapi.ResourceSlice {
211
216
sliceName := fmt .Sprintf ("%s-%s-slice" , driverName , poolName )
212
217
var devices []resourceapi.Device
213
218
for i := 0 ; i < partitionCount ; i ++ {
@@ -262,7 +267,7 @@ func testResourceSlicesWithPartionableDevices(driverName, poolName, nodeName str
262
267
Spec : resourceapi.ResourceSliceSpec {
263
268
Driver : driverName ,
264
269
NodeName : nodeName ,
265
- Pool : resourceapi.ResourcePool {Name : poolName , Generation : 0 , ResourceSliceCount : 1 },
270
+ Pool : resourceapi.ResourcePool {Name : poolName , Generation : int64 ( poolGen ) , ResourceSliceCount : 1 },
266
271
Devices : devices ,
267
272
SharedCounters : []resourceapi.CounterSet {
268
273
{
0 commit comments