diff options
author | Florian Klink <flokli@flokli.de> | 2024-03-27T11·12+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-03-28T07·58+0000 |
commit | 3cb943460580cffb83b46c0ae3e7957eaf9170ef (patch) | |
tree | 94ed7b40805e00f77b4ee2760a9592960131ff4d /tvix/store/src/nar/import.rs | |
parent | 07a51c7dc9dd37205368eb0653e23e33cc04406f (diff) |
refactor(tvix/store/nar/import): use rstest fixtures from castore r/7789
This stops using the gen_{blob,directory}_service() functions from tvix_castore::utils in favor of the rstest-based fixtures. Change-Id: I4c2fff2926f34af63d3bd5c29c8e939dbdf7e062 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11274 Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/nar/import.rs')
-rw-r--r-- | tvix/store/src/nar/import.rs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tvix/store/src/nar/import.rs b/tvix/store/src/nar/import.rs index 20b922a61f2e..6f4dcdea5d96 100644 --- a/tvix/store/src/nar/import.rs +++ b/tvix/store/src/nar/import.rs @@ -223,6 +223,7 @@ mod test { use std::io::Cursor; use std::sync::Arc; + use rstest::*; use tokio_stream::StreamExt; use tvix_castore::blobservice::BlobService; use tvix_castore::directoryservice::DirectoryService; @@ -231,17 +232,18 @@ mod test { HELLOWORLD_BLOB_DIGEST, }; use tvix_castore::proto as castorepb; - use tvix_castore::utils::{gen_blob_service, gen_directory_service}; use crate::tests::fixtures::{ - NAR_CONTENTS_COMPLICATED, NAR_CONTENTS_HELLOWORLD, NAR_CONTENTS_SYMLINK, + blob_service, directory_service, NAR_CONTENTS_COMPLICATED, NAR_CONTENTS_HELLOWORLD, + NAR_CONTENTS_SYMLINK, }; + #[rstest] #[tokio::test] - async fn single_symlink() { - let blob_service = gen_blob_service(); - let directory_service = gen_directory_service(); - + async fn single_symlink( + blob_service: Arc<dyn BlobService>, + directory_service: Arc<dyn DirectoryService>, + ) { let handle = tokio::runtime::Handle::current(); let root_node = handle @@ -265,11 +267,12 @@ mod test { ); } + #[rstest] #[tokio::test] - async fn single_file() { - let blob_service: Arc<dyn BlobService> = gen_blob_service().into(); - let directory_service = gen_directory_service(); - + async fn single_file( + blob_service: Arc<dyn BlobService>, + directory_service: Arc<dyn DirectoryService>, + ) { let handle = tokio::runtime::Handle::current(); let root_node = handle @@ -301,11 +304,12 @@ mod test { assert!(blob_service.has(&HELLOWORLD_BLOB_DIGEST).await.unwrap()); } + #[rstest] #[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(); - + async fn complicated( + blob_service: Arc<dyn BlobService>, + directory_service: Arc<dyn DirectoryService>, + ) { let handle = tokio::runtime::Handle::current(); let root_node = handle |