test(tvix/store): test listing endpoint too

Change-Id: Ia4035aca43cf9d3f7de982dd154715120ba25496
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11927
Reviewed-by: Brian Olsen <me@griff.name>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-07-02 18:14:13 +03:00 committed by clbot
parent eb9a74d966
commit 9ed967791c

View file

@ -2,6 +2,7 @@
//! We use [rstest] and [rstest_reuse] to provide all services we want to test //! We use [rstest] and [rstest_reuse] to provide all services we want to test
//! against, and then apply this template to all test functions. //! against, and then apply this template to all test functions.
use futures::TryStreamExt;
use rstest::*; use rstest::*;
use rstest_reuse::{self, *}; use rstest_reuse::{self, *};
@ -68,5 +69,12 @@ async fn put_get(svc: impl PathInfoService) {
// get it back // get it back
let resp = svc.get(DUMMY_PATH_DIGEST).await.expect("must succeed"); let resp = svc.get(DUMMY_PATH_DIGEST).await.expect("must succeed");
assert_eq!(Some(path_info), resp); assert_eq!(Some(path_info.clone()), resp);
// Ensure the listing endpoint works, and returns the same path_info.
// FUTUREWORK: split this, some impls might (rightfully) not support listing
let pathinfos: Vec<PathInfo> = svc.list().try_collect().await.expect("must succeed");
// We should get a single pathinfo back, the one we inserted.
assert_eq!(vec![path_info], pathinfos);
} }