Skip to content

Commit 030948b

Browse files
committed
modify test
1 parent fceeab8 commit 030948b

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

database/src/pool.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,9 +980,28 @@ mod tests {
980980

981981
db.mark_benchmark_request_as_completed(tag).await.unwrap();
982982

983-
let completed = db.load_benchmark_request_index().await.unwrap();
983+
/* From the status page view we can see that the duration has been
984+
* updated. Albeit that it will be a very short duration. */
985+
let status_page_view = db.get_status_page_data().await.unwrap();
986+
let req = &status_page_view
987+
.completed_requests
988+
.iter()
989+
.find(|it| it.0.tag() == Some(tag))
990+
.unwrap()
991+
.0;
992+
993+
assert!(matches!(
994+
req.status(),
995+
BenchmarkRequestStatus::Completed { .. }
996+
));
997+
let BenchmarkRequestStatus::Completed { duration_ms, .. } = req.status() else {
998+
unreachable!();
999+
};
1000+
assert!(duration_ms >= 1);
1001+
1002+
let completed_index = db.load_benchmark_request_index().await.unwrap();
1003+
assert!(completed_index.contains_tag("sha-1"));
9841004

985-
assert!(completed.contains_tag("sha-1"));
9861005
Ok(ctx)
9871006
})
9881007
.await;

database/src/pool/postgres.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,8 @@ where
20822082
(
20832083
row_to_benchmark_request(it),
20842084
// The errors, if there are none this will be an empty vector
2085-
it.get::<_, Vec<String>>(11),
2085+
it.get::<_, Option<Vec<String>>>(11)
2086+
.unwrap_or_else(|| vec![]),
20862087
)
20872088
})
20882089
.collect();

0 commit comments

Comments
 (0)