about summary refs log tree commit diff
path: root/tvix/store/src/pathinfoservice
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-27T11·20+0100
committerflokli <flokli@flokli.de>2024-03-28T07·58+0000
commit1255916b5a1279dabda06c8b3c345bb10cd025a6 (patch)
treec9c23bf31c0ad0a0349aea6ff0e7585eab35a8fd /tvix/store/src/pathinfoservice
parent024409bb909de9bc8f84bbaa88e6f8174a03fba4 (diff)
refactor(tvix/pathinfo/grpc): use rstest fixtures r/7792
Change-Id: Ib114a4d141ca829520aed34600678d613994f875
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11277
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/pathinfoservice')
-rw-r--r--tvix/store/src/pathinfoservice/grpc.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs
index 17d202094a11..7d740429cfba 100644
--- a/tvix/store/src/pathinfoservice/grpc.rs
+++ b/tvix/store/src/pathinfoservice/grpc.rs
@@ -122,27 +122,33 @@ impl PathInfoService for GRPCPathInfoService {
 
 #[cfg(test)]
 mod tests {
+    use std::sync::Arc;
     use std::time::Duration;
 
+    use rstest::*;
     use tempfile::TempDir;
     use tokio::net::UnixListener;
     use tokio_retry::strategy::ExponentialBackoff;
     use tokio_retry::Retry;
     use tokio_stream::wrappers::UnixListenerStream;
+    use tvix_castore::blobservice::BlobService;
+    use tvix_castore::directoryservice::DirectoryService;
 
     use crate::pathinfoservice::MemoryPathInfoService;
     use crate::proto::path_info_service_client::PathInfoServiceClient;
     use crate::proto::GRPCPathInfoServiceWrapper;
-    use crate::tests::fixtures;
-    use crate::tests::utils::gen_blob_service;
-    use crate::tests::utils::gen_directory_service;
+    use crate::tests::fixtures::{self, blob_service, directory_service};
 
     use super::GRPCPathInfoService;
     use super::PathInfoService;
 
     /// This ensures connecting via gRPC works as expected.
+    #[rstest]
     #[tokio::test]
-    async fn test_valid_unix_path_ping_pong() {
+    async fn test_valid_unix_path_ping_pong(
+        blob_service: Arc<dyn BlobService>,
+        directory_service: Arc<dyn DirectoryService>,
+    ) {
         let tmpdir = TempDir::new().unwrap();
         let socket_path = tmpdir.path().join("daemon");
 
@@ -158,8 +164,8 @@ mod tests {
             let router = server.add_service(
                 crate::proto::path_info_service_server::PathInfoServiceServer::new(
                     GRPCPathInfoServiceWrapper::new(Box::new(MemoryPathInfoService::new(
-                        gen_blob_service(),
-                        gen_directory_service(),
+                        blob_service,
+                        directory_service,
                     ))
                         as Box<dyn PathInfoService>),
                 ),