Skip to content

Commit c0d4708

Browse files
committed
re-do all tests
1 parent 28279b5 commit c0d4708

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

site/src/job_queue.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ fn sort_benchmark_requests<'a>(done: &HashSet<String>, request_queue: &'a mut [B
6969
// let the commits be benchmarked in the current order that we have, these benchmark runs
7070
// just won't have a parent result available.
7171
if level_len == 0 {
72-
log::warn!("No commit is ready for benchmarking");
73-
#[cfg(test)]
74-
{
72+
if cfg!(test) {
7573
panic!("No commit is ready for benchmarking");
74+
} else {
75+
log::warn!("No commit is ready for benchmarking");
76+
return;
7677
}
77-
return;
7878
}
7979

8080
// Everything in level has the same topological order, then we sort based on heuristics
@@ -525,8 +525,16 @@ mod tests {
525525
* | m "rrr" C | -----+-->
526526
* +-----------+ |
527527
* | +---------------+
528-
* +--->| t "yee" R pr1 | 5: a try with a low pr
528+
* +--->| t "yee" R pr1 | 6: a try with a low pr
529529
* +---------------+
530+
* +-----------+
531+
* | m "aaa" C |
532+
* +-----------+
533+
* |
534+
* V
535+
* +----------------+
536+
* | m "mmm" R pr88 | 4: a master commit
537+
* +----------------+
530538
*
531539
* +-----------+
532540
* | m "345" C |
@@ -549,7 +557,7 @@ mod tests {
549557
* |
550558
* V
551559
* +---------------+
552-
* | t "baz" R pr4 | 6: a try with a higher pr
560+
* | t "baz" R pr4 | 7: a try with a higher pr
553561
* +---------------+
554562
*
555563
* The master commits should take priority, then "yee" followed
@@ -563,19 +571,24 @@ mod tests {
563571
create_try("baz", "foo", 4, "days1"),
564572
create_release("v.1.2.3", "days2"),
565573
create_try("yee", "rrr", 1, "days2"), // lower PR number takes priority
566-
create_try("t1", "rrr", 1, "days2").with_status(BenchmarkRequestStatus::InProgress),
574+
create_try("t1", "rrr", 1, "days1").with_status(BenchmarkRequestStatus::InProgress),
575+
create_master("mmm", "aaa", 88, "days2"),
567576
];
568577

569578
db_insert_requests(&*db, &requests).await;
570579

571-
let completed: HashSet<String> =
572-
HashSet::from(["bar".to_string(), "345".to_string(), "rrr".to_string()]);
580+
let completed: HashSet<String> = HashSet::from([
581+
"bar".to_string(),
582+
"345".to_string(),
583+
"rrr".to_string(),
584+
"aaa".to_string(),
585+
]);
573586

574587
let sorted: Vec<BenchmarkRequest> = build_queue(&mut *db, &completed).await.unwrap();
575588

576589
assert!(queue_order_matches(
577590
&sorted,
578-
&["t1", "v.1.2.3", "123", "foo", "yee", "baz"]
591+
&["t1", "v.1.2.3", "123", "foo", "mmm", "yee", "baz"]
579592
));
580593
Ok(ctx)
581594
})

0 commit comments

Comments
 (0)