about summary refs log tree commit diff
path: root/tvix/store/src/pathinfoservice/tests/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-07-02T15·14+0300
committerclbot <clbot@tvl.fyi>2024-07-03T12·35+0000
commit9ed967791c5f3c15f7b637efc5efa60044239721 (patch)
treeee4ae2c033d0cc9cb79b15d60838a2fe0d7e993a /tvix/store/src/pathinfoservice/tests/mod.rs
parenteb9a74d966ccdeb1c7a603a5f9d7957592fa66ff (diff)
test(tvix/store): test listing endpoint too r/8341
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
Diffstat (limited to 'tvix/store/src/pathinfoservice/tests/mod.rs')
-rw-r--r--tvix/store/src/pathinfoservice/tests/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/tvix/store/src/pathinfoservice/tests/mod.rs b/tvix/store/src/pathinfoservice/tests/mod.rs
index 061655e4bafc..82684080156d 100644
--- a/tvix/store/src/pathinfoservice/tests/mod.rs
+++ b/tvix/store/src/pathinfoservice/tests/mod.rs
@@ -2,6 +2,7 @@
 //! We use [rstest] and [rstest_reuse] to provide all services we want to test
 //! against, and then apply this template to all test functions.
 
+use futures::TryStreamExt;
 use rstest::*;
 use rstest_reuse::{self, *};
 
@@ -68,5 +69,12 @@ async fn put_get(svc: impl PathInfoService) {
     // get it back
     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);
 }