about summary refs log tree commit diff
path: root/tvix/castore/src/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-09T09·04+0200
committerclbot <clbot@tvl.fyi>2024-01-09T14·08+0000
commit89882ff9b13ff1c25fc64605e3fc87ae7b9ab877 (patch)
tree4eaf9a8d3214ec8acda1fa5f94c2fc9624438518 /tvix/castore/src/tests
parent8fbdf72825843416dc1923d91cb20059cdbc07b1 (diff)
refactor(tvix): use AsRef<dyn …> instead of Deref<Target= …> r/7359
Removes some more needs for Arcs.

Change-Id: I9a9f4b81641c271de260e9ffa98313a32944d760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10578
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/castore/src/tests')
-rw-r--r--tvix/castore/src/tests/import.rs26
1 files changed, 10 insertions, 16 deletions
diff --git a/tvix/castore/src/tests/import.rs b/tvix/castore/src/tests/import.rs
index 333254706d61..99e993f36da3 100644
--- a/tvix/castore/src/tests/import.rs
+++ b/tvix/castore/src/tests/import.rs
@@ -1,10 +1,8 @@
 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::ops::Deref;
 use std::sync::Arc;
 use tempfile::TempDir;
 
@@ -14,8 +12,8 @@ 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 blob_service = gen_blob_service();
+    let directory_service = gen_directory_service();
 
     let tmpdir = TempDir::new().unwrap();
 
@@ -27,8 +25,8 @@ async fn symlink() {
     .unwrap();
 
     let root_node = ingest_path(
-        blob_service,
-        &directory_service.deref(),
+        Arc::from(blob_service),
+        directory_service,
         tmpdir.path().join("doesntmatter"),
     )
     .await
@@ -46,7 +44,7 @@ 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 directory_service = gen_directory_service();
 
     let tmpdir = TempDir::new().unwrap();
 
@@ -54,7 +52,7 @@ async fn single_file() {
 
     let root_node = ingest_path(
         blob_service.clone(),
-        &directory_service.deref(),
+        directory_service,
         tmpdir.path().join("root"),
     )
     .await
@@ -78,7 +76,7 @@ async fn single_file() {
 #[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 directory_service = gen_directory_service();
 
     let tmpdir = TempDir::new().unwrap();
 
@@ -91,13 +89,9 @@ async fn complicated() {
     // File ``keep/.keep`
     std::fs::write(tmpdir.path().join("keep").join(".keep"), vec![]).unwrap();
 
-    let root_node = ingest_path(
-        blob_service.clone(),
-        &directory_service.deref(),
-        tmpdir.path(),
-    )
-    .await
-    .expect("must succeed");
+    let root_node = ingest_path(blob_service.clone(), &directory_service, tmpdir.path())
+        .await
+        .expect("must succeed");
 
     // ensure root_node matched expectations
     assert_eq!(