about summary refs log tree commit diff
path: root/tvix/store/src/proto/tests/grpc_pathinfoservice.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-01T17·55+0100
committerflokli <flokli@flokli.de>2023-03-10T10·58+0000
commita4f6c4181aa7f975b1c3aad8d3fb30021388e014 (patch)
treeee2f0a3911503ccb66f29d5b47dbdd763c02b026 /tvix/store/src/proto/tests/grpc_pathinfoservice.rs
parent535e1b15ab457c9015baebf14bd7b50a38edadb4 (diff)
feat(tvix/store): add new_temporary for all Sled services r/5934
This provides a service using /dev/shm, that's deleted once the
reference is dropped.

Refactor all tests to use these, which allows getting rid of most
TempDir usage in the tests.

The only place where we still use TempDir is in the importer tests,
which work on a filesystem path.

Change-Id: I08a950aa774bf9b46d9f5c92edf5efba36053242
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8193
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/proto/tests/grpc_pathinfoservice.rs')
-rw-r--r--tvix/store/src/proto/tests/grpc_pathinfoservice.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/tvix/store/src/proto/tests/grpc_pathinfoservice.rs b/tvix/store/src/proto/tests/grpc_pathinfoservice.rs
index ce74711cb555..f74c3fda0213 100644
--- a/tvix/store/src/proto/tests/grpc_pathinfoservice.rs
+++ b/tvix/store/src/proto/tests/grpc_pathinfoservice.rs
@@ -9,8 +9,6 @@ use crate::tests::fixtures::DUMMY_OUTPUT_HASH;
 use crate::tests::utils::{
     gen_blob_service, gen_chunk_service, gen_directory_service, gen_pathinfo_service,
 };
-use std::path::Path;
-use tempfile::TempDir;
 use tonic::Request;
 
 /// generates a GRPCPathInfoService out of blob, chunk, directory and pathinfo services.
@@ -18,13 +16,13 @@ use tonic::Request;
 /// We only interact with it via the PathInfo GRPC interface.
 /// It uses the NonCachingNARCalculationService NARCalculationService to
 /// calculate NARs.
-fn gen_grpc_service(p: &Path) -> impl GRPCPathInfoService {
+fn gen_grpc_service() -> impl GRPCPathInfoService {
     GRPCPathInfoServiceWrapper::new(
-        gen_pathinfo_service(p),
+        gen_pathinfo_service(),
         NonCachingNARCalculationService::new(
-            gen_blob_service(p),
-            gen_chunk_service(p),
-            gen_directory_service(p),
+            gen_blob_service(),
+            gen_chunk_service(),
+            gen_directory_service(),
         ),
     )
 }
@@ -32,8 +30,7 @@ fn gen_grpc_service(p: &Path) -> impl GRPCPathInfoService {
 /// Trying to get a non-existent PathInfo should return a not found error.
 #[tokio::test]
 async fn not_found() {
-    let tmpdir = TempDir::new().unwrap();
-    let service = gen_grpc_service(tmpdir.path());
+    let service = gen_grpc_service();
 
     let resp = service
         .get(Request::new(GetPathInfoRequest {
@@ -48,8 +45,7 @@ async fn not_found() {
 /// Put a PathInfo into the store, get it back.
 #[tokio::test]
 async fn put_get() {
-    let tmpdir = TempDir::new().unwrap();
-    let service = gen_grpc_service(tmpdir.path());
+    let service = gen_grpc_service();
 
     let path_info = PathInfo {
         node: Some(Node {