From 1255916b5a1279dabda06c8b3c345bb10cd025a6 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 27 Mar 2024 12:20:34 +0100 Subject: refactor(tvix/pathinfo/grpc): use rstest fixtures Change-Id: Ib114a4d141ca829520aed34600678d613994f875 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11277 Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/store/src/pathinfoservice/grpc.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs index 17d202094a..7d740429cf 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, + directory_service: Arc, + ) { 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), ), -- cgit 1.4.1