@@ -182,7 +182,16 @@ fn sort_benchmark_requests(done: &HashSet<String>, request_queue: &mut [Benchmar
182
182
)
183
183
} ) ;
184
184
for c in level {
185
- done. insert ( c. tag ( ) . to_string ( ) ) ;
185
+ // As the only `commit_type` that will not have a `tag` is a `Try`
186
+ // with the status of `AwaitingArtifacts` and we have asserted above
187
+ // that all of the statuses of the benchmark requests are
188
+ // `ArtifactsReady` it is implausable for this `expect(...)` to be
189
+ // hit.
190
+ done. insert (
191
+ c. tag ( )
192
+ . expect ( "Tag should exist on a benchmark request being sorted" )
193
+ . to_string ( ) ,
194
+ ) ;
186
195
}
187
196
finished += level_len;
188
197
}
@@ -241,7 +250,7 @@ pub async fn build_queue(
241
250
242
251
release_artifacts. sort_unstable_by ( |a, b| {
243
252
a. tag ( )
244
- . cmp ( b. tag ( ) )
253
+ . cmp ( & b. tag ( ) )
245
254
. then_with ( || a. created_at . cmp ( & b. created_at ) )
246
255
} ) ;
247
256
@@ -258,7 +267,7 @@ async fn enqueue_next_job(conn: &mut dyn database::pool::Connection) -> anyhow::
258
267
. get_benchmark_requests_by_status ( & [ BenchmarkRequestStatus :: Completed ] )
259
268
. await ?
260
269
. into_iter ( )
261
- . map ( |request| request. tag ( ) . to_string ( ) )
270
+ . filter_map ( |request| request. tag ( ) . map ( |tag| tag . to_string ( ) ) )
262
271
. collect ( ) ;
263
272
264
273
let queue = build_queue ( conn, & completed) . await ?;
@@ -360,7 +369,7 @@ mod tests {
360
369
361
370
fn create_try ( sha : & str , parent : & str , pr : u32 , age_days : & str ) -> BenchmarkRequest {
362
371
BenchmarkRequest :: create_try (
363
- sha,
372
+ Some ( sha) ,
364
373
Some ( parent) ,
365
374
pr,
366
375
days_ago ( age_days) ,
@@ -390,7 +399,10 @@ mod tests {
390
399
}
391
400
392
401
fn queue_order_matches ( queue : & [ BenchmarkRequest ] , expected : & [ & str ] ) {
393
- let queue_shas: Vec < & str > = queue. iter ( ) . map ( |req| req. tag ( ) ) . collect ( ) ;
402
+ let queue_shas: Vec < & str > = queue
403
+ . iter ( )
404
+ . filter_map ( |request| request. tag ( ) . map ( |tag| tag) )
405
+ . collect ( ) ;
394
406
assert_eq ! ( queue_shas, expected)
395
407
}
396
408
@@ -423,23 +435,23 @@ mod tests {
423
435
* +------------+
424
436
* | r "v1.2.3" |
425
437
* +------------+
438
+ *
439
+ *
440
+ *
426
441
* 1: Currently `in_progress`
427
- * +---------------+
428
- * +--->| t "t1" IP pr1 |
429
- * | +---------------+
430
- * +-----------+ |
431
- * | m "rrr" C | -----+-->
432
- * +-----------+ |
433
- * | +---------------+
434
- * +--->| t "yee" R pr1 | 3: a try with a low pr
435
- * +---------------+
442
+ * +-----------+ +---------------+
443
+ * | m "rrr" C | -----+--->| t "t1" IP pr1 |
444
+ * +-----------+ +---------------+
445
+ *
446
+ *
447
+ *
436
448
* +-----------+
437
449
* | m "aaa" C |
438
450
* +-----------+
439
451
* |
440
452
* V
441
453
* +----------------+
442
- * | m "mmm" R pr88 | 6 : a master commit
454
+ * | m "mmm" R pr88 | 5 : a master commit
443
455
* +----------------+
444
456
*
445
457
* +-----------+
@@ -448,7 +460,7 @@ mod tests {
448
460
* |
449
461
* V
450
462
* +----------------+
451
- * | m "123" R pr11 | 4 : a master commit, high pr number
463
+ * | m "123" R pr11 | 3 : a master commit, high pr number
452
464
* +----------------+
453
465
*
454
466
*
@@ -458,12 +470,12 @@ mod tests {
458
470
* |
459
471
* V
460
472
* +----------------+
461
- * | m "foo" R pr77 | 5 : a master commit
473
+ * | m "foo" R pr77 | 4 : a master commit
462
474
* +----------------+
463
475
* |
464
476
* V
465
477
* +---------------+
466
- * | t "baz" R pr4 | 7 : a try with a low pr, blocked by parent
478
+ * | t "baz" R pr4 | 6 : a try with a low pr, blocked by parent
467
479
* +---------------+
468
480
*
469
481
* The master commits should take priority, then "yee" followed
@@ -476,7 +488,6 @@ mod tests {
476
488
create_master( "123" , "345" , 11 , "days2" ) ,
477
489
create_try( "baz" , "foo" , 4 , "days1" ) ,
478
490
create_release( "v.1.2.3" , "days2" ) ,
479
- create_try( "yee" , "rrr" , 1 , "days2" ) , // lower PR number takes priority
480
491
create_try( "t1" , "rrr" , 1 , "days1" ) . with_status( BenchmarkRequestStatus :: InProgress ) ,
481
492
create_master( "mmm" , "aaa" , 88 , "days2" ) ,
482
493
] ;
@@ -492,10 +503,7 @@ mod tests {
492
503
493
504
let sorted: Vec < BenchmarkRequest > = build_queue ( & mut * db, & completed) . await . unwrap ( ) ;
494
505
495
- queue_order_matches (
496
- & sorted,
497
- & [ "t1" , "v.1.2.3" , "yee" , "123" , "foo" , "mmm" , "baz" ] ,
498
- ) ;
506
+ queue_order_matches ( & sorted, & [ "t1" , "v.1.2.3" , "123" , "foo" , "mmm" , "baz" ] ) ;
499
507
Ok ( ctx)
500
508
} )
501
509
. await ;
0 commit comments