From 9ed967791c5f3c15f7b637efc5efa60044239721 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 2 Jul 2024 18:14:13 +0300 Subject: test(tvix/store): test listing endpoint too Change-Id: Ia4035aca43cf9d3f7de982dd154715120ba25496 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11927 Reviewed-by: Brian Olsen Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/store/src/pathinfoservice/tests/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tvix/store/src/pathinfoservice/tests') 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 = 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); } -- cgit 1.4.1