about summary refs log tree commit diff
path: root/tvix/castore/src
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore/src')
-rw-r--r--tvix/castore/src/directoryservice/traverse.rs4
-rw-r--r--tvix/castore/src/tests/import.rs23
-rw-r--r--tvix/castore/src/utils.rs10
3 files changed, 22 insertions, 15 deletions
diff --git a/tvix/castore/src/directoryservice/traverse.rs b/tvix/castore/src/directoryservice/traverse.rs
index 5289751e50dc..1d1de6e18faa 100644
--- a/tvix/castore/src/directoryservice/traverse.rs
+++ b/tvix/castore/src/directoryservice/traverse.rs
@@ -86,7 +86,9 @@ where
 #[cfg(test)]
 mod tests {
     use std::path::PathBuf;
+    use std::sync::Arc;
 
+    use crate::directoryservice::DirectoryService;
     use crate::fixtures::{DIRECTORY_COMPLICATED, DIRECTORY_WITH_KEEP};
     use crate::utils::gen_directory_service;
 
@@ -94,7 +96,7 @@ mod tests {
 
     #[tokio::test]
     async fn test_descend_to() {
-        let directory_service = gen_directory_service();
+        let directory_service: Arc<dyn DirectoryService> = gen_directory_service().into();
 
         let mut handle = directory_service.put_multiple_start();
         handle
diff --git a/tvix/castore/src/tests/import.rs b/tvix/castore/src/tests/import.rs
index 2a2e8ae00acf..75c632799cd9 100644
--- a/tvix/castore/src/tests/import.rs
+++ b/tvix/castore/src/tests/import.rs
@@ -1,7 +1,10 @@
+use crate::blobservice::BlobService;
+use crate::directoryservice::DirectoryService;
 use crate::fixtures::*;
 use crate::import::ingest_path;
 use crate::proto;
 use crate::utils::{gen_blob_service, gen_directory_service};
+use std::sync::Arc;
 use tempfile::TempDir;
 
 #[cfg(target_family = "unix")]
@@ -10,6 +13,9 @@ use std::os::unix::ffi::OsStrExt;
 #[cfg(target_family = "unix")]
 #[tokio::test]
 async fn symlink() {
+    let blob_service: Arc<dyn BlobService> = gen_blob_service().into();
+    let directory_service: Arc<dyn DirectoryService> = gen_directory_service().into();
+
     let tmpdir = TempDir::new().unwrap();
 
     std::fs::create_dir_all(&tmpdir).unwrap();
@@ -20,8 +26,8 @@ async fn symlink() {
     .unwrap();
 
     let root_node = ingest_path(
-        gen_blob_service(),
-        gen_directory_service(),
+        blob_service,
+        directory_service,
         tmpdir.path().join("doesntmatter"),
     )
     .await
@@ -38,15 +44,16 @@ async fn symlink() {
 
 #[tokio::test]
 async fn single_file() {
+    let blob_service: Arc<dyn BlobService> = gen_blob_service().into();
+    let directory_service: Arc<dyn DirectoryService> = gen_directory_service().into();
+
     let tmpdir = TempDir::new().unwrap();
 
     std::fs::write(tmpdir.path().join("root"), HELLOWORLD_BLOB_CONTENTS).unwrap();
 
-    let blob_service = gen_blob_service();
-
     let root_node = ingest_path(
         blob_service.clone(),
-        gen_directory_service(),
+        directory_service,
         tmpdir.path().join("root"),
     )
     .await
@@ -69,6 +76,9 @@ async fn single_file() {
 #[cfg(target_family = "unix")]
 #[tokio::test]
 async fn complicated() {
+    let blob_service: Arc<dyn BlobService> = gen_blob_service().into();
+    let directory_service: Arc<dyn DirectoryService> = gen_directory_service().into();
+
     let tmpdir = TempDir::new().unwrap();
 
     // File ``.keep`
@@ -80,9 +90,6 @@ async fn complicated() {
     // File ``keep/.keep`
     std::fs::write(tmpdir.path().join("keep").join(".keep"), vec![]).unwrap();
 
-    let blob_service = gen_blob_service();
-    let directory_service = gen_directory_service();
-
     let root_node = ingest_path(
         blob_service.clone(),
         directory_service.clone(),
diff --git a/tvix/castore/src/utils.rs b/tvix/castore/src/utils.rs
index d9a7254a5651..ca68f9f26c5a 100644
--- a/tvix/castore/src/utils.rs
+++ b/tvix/castore/src/utils.rs
@@ -1,8 +1,6 @@
 //! A crate containing constructors to provide instances of a BlobService and
 //! DirectoryService. Only used for testing purposes, but across crates.
 //! Should be removed once we have a better concept of a "Service registry".
-use std::sync::Arc;
-
 use tonic::transport::{Channel, Endpoint, Server, Uri};
 
 use crate::{
@@ -16,12 +14,12 @@ use crate::{
     },
 };
 
-pub fn gen_blob_service() -> Arc<dyn BlobService> {
-    Arc::new(MemoryBlobService::default())
+pub fn gen_blob_service() -> Box<dyn BlobService> {
+    Box::<MemoryBlobService>::default()
 }
 
-pub fn gen_directory_service() -> Arc<dyn DirectoryService> {
-    Arc::new(MemoryDirectoryService::default())
+pub fn gen_directory_service() -> Box<dyn DirectoryService> {
+    Box::<MemoryDirectoryService>::default()
 }
 
 /// This will spawn the a gRPC server with a DirectoryService client, connect a