@@ -2186,6 +2186,7 @@ func TestGetProvisionerJobsByIDsWithQueuePosition(t *testing.T) {
2186
2186
// but this should not affect the queue position or queue size of other jobs.
2187
2187
skipJobIDs map [int ]struct {}
2188
2188
}{
2189
+ // Baseline test case
2189
2190
{
2190
2191
name : "test-case-1" ,
2191
2192
jobTags : []database.StringMap {
@@ -2200,7 +2201,7 @@ func TestGetProvisionerJobsByIDsWithQueuePosition(t *testing.T) {
2200
2201
queueSizes : []int64 {2 , 2 , 0 },
2201
2202
queuePositions : []int64 {1 , 1 , 0 },
2202
2203
},
2203
- // Similar to the previous case, but includes an additional provisioner.
2204
+ // Includes an additional provisioner
2204
2205
{
2205
2206
name : "test-case-2" ,
2206
2207
jobTags : []database.StringMap {
@@ -2216,7 +2217,7 @@ func TestGetProvisionerJobsByIDsWithQueuePosition(t *testing.T) {
2216
2217
queueSizes : []int64 {3 , 3 , 3 },
2217
2218
queuePositions : []int64 {1 , 1 , 3 },
2218
2219
},
2219
- // Similar to the previous case, but skips job at index 0
2220
+ // Skips job at index 0
2220
2221
{
2221
2222
name : "test-case-3" ,
2222
2223
jobTags : []database.StringMap {
@@ -2293,6 +2294,46 @@ func TestGetProvisionerJobsByIDsWithQueuePosition(t *testing.T) {
2293
2294
2 : {},
2294
2295
},
2295
2296
},
2297
+ // Includes two additional jobs that any provisioner can execute.
2298
+ {
2299
+ name : "test-case-7" ,
2300
+ jobTags : []database.StringMap {
2301
+ {},
2302
+ {},
2303
+ {"a" : "1" , "b" : "2" },
2304
+ {"a" : "1" },
2305
+ {"a" : "1" , "c" : "3" },
2306
+ },
2307
+ daemonTags : []database.StringMap {
2308
+ {"a" : "1" , "b" : "2" },
2309
+ {"a" : "1" },
2310
+ {"a" : "1" , "b" : "2" , "c" : "3" },
2311
+ },
2312
+ queueSizes : []int64 {5 , 5 , 5 , 5 , 5 },
2313
+ queuePositions : []int64 {1 , 2 , 3 , 3 , 5 },
2314
+ },
2315
+ // Includes two additional jobs that any provisioner can execute, but they are intentionally skipped.
2316
+ {
2317
+ name : "test-case-8" ,
2318
+ jobTags : []database.StringMap {
2319
+ {},
2320
+ {},
2321
+ {"a" : "1" , "b" : "2" },
2322
+ {"a" : "1" },
2323
+ {"a" : "1" , "c" : "3" },
2324
+ },
2325
+ daemonTags : []database.StringMap {
2326
+ {"a" : "1" , "b" : "2" },
2327
+ {"a" : "1" },
2328
+ {"a" : "1" , "b" : "2" , "c" : "3" },
2329
+ },
2330
+ queueSizes : []int64 {5 , 5 , 5 },
2331
+ queuePositions : []int64 {3 , 3 , 5 },
2332
+ skipJobIDs : map [int ]struct {}{
2333
+ 0 : {},
2334
+ 1 : {},
2335
+ },
2336
+ },
2296
2337
}
2297
2338
2298
2339
for _ , tc := range testCases {
0 commit comments