about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-27T11·18+0100
committerflokli <flokli@flokli.de>2024-03-28T07·58+0000
commitea257589d3e3fe4aa451bd5d7845b6feb456ae81 (patch)
treee5aec435ef16f0352ff3351e309e9d36ff5175ed
parent1255916b5a1279dabda06c8b3c345bb10cd025a6 (diff)
refactor(tvix/store/pathinfo/from_addr): stop using gen_*_service r/7793
Remove usage of the gen_{blob,directory}_service() helper functions
from utils. We populate Memory{Blob,Directory}Services here directly, as
test_case and rstest doesn't compose well.

Change-Id: I0fb48aadb8c818f508b18ceb83c85eb91359442a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11278
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
-rw-r--r--tvix/store/src/pathinfoservice/from_addr.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/tvix/store/src/pathinfoservice/from_addr.rs b/tvix/store/src/pathinfoservice/from_addr.rs
index 142428768d..6109054d7a 100644
--- a/tvix/store/src/pathinfoservice/from_addr.rs
+++ b/tvix/store/src/pathinfoservice/from_addr.rs
@@ -121,9 +121,13 @@ pub async fn from_addr(
 mod tests {
     use super::from_addr;
     use lazy_static::lazy_static;
+    use std::sync::Arc;
     use tempfile::TempDir;
     use test_case::test_case;
-    use tvix_castore::utils::{gen_blob_service, gen_directory_service};
+    use tvix_castore::{
+        blobservice::{BlobService, MemoryBlobService},
+        directoryservice::{DirectoryService, MemoryDirectoryService},
+    };
 
     lazy_static! {
         static ref TMPDIR_SLED_1: TempDir = TempDir::new().unwrap();
@@ -178,12 +182,11 @@ mod tests {
     #[test_case("grpc+http://localhost/some-path", false; "grpc valid invalid host and path")]
     #[tokio::test]
     async fn test_from_addr_tokio(uri_str: &str, exp_succeed: bool) {
-        let resp = from_addr(
-            uri_str,
-            gen_blob_service().into(),
-            gen_directory_service().into(),
-        )
-        .await;
+        let blob_service: Arc<dyn BlobService> = Arc::from(MemoryBlobService::default());
+        let directory_service: Arc<dyn DirectoryService> =
+            Arc::from(MemoryDirectoryService::default());
+
+        let resp = from_addr(uri_str, blob_service, directory_service).await;
 
         if exp_succeed {
             resp.expect("should succeed");