diff options
author | Florian Klink <flokli@flokli.de> | 2023-03-01T17·55+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-03-10T10·58+0000 |
commit | a4f6c4181aa7f975b1c3aad8d3fb30021388e014 (patch) | |
tree | ee2f0a3911503ccb66f29d5b47dbdd763c02b026 /tvix/store/src/tests/utils.rs | |
parent | 535e1b15ab457c9015baebf14bd7b50a38edadb4 (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/tests/utils.rs')
-rw-r--r-- | tvix/store/src/tests/utils.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs index 4ddd4102fb97..9da9d2643b81 100644 --- a/tvix/store/src/tests/utils.rs +++ b/tvix/store/src/tests/utils.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use crate::{ blobservice::{BlobService, SledBlobService}, chunkservice::{ChunkService, SledChunkService}, @@ -7,18 +5,18 @@ use crate::{ pathinfoservice::{PathInfoService, SledPathInfoService}, }; -pub fn gen_blob_service(p: &Path) -> impl BlobService + Send + Sync + Clone + 'static { - SledBlobService::new(p.join("blobs")).unwrap() +pub fn gen_blob_service() -> impl BlobService + Send + Sync + Clone + 'static { + SledBlobService::new_temporary().unwrap() } -pub fn gen_chunk_service(p: &Path) -> impl ChunkService + Clone { - SledChunkService::new(p.join("chunks")).unwrap() +pub fn gen_chunk_service() -> impl ChunkService + Clone { + SledChunkService::new_temporary().unwrap() } -pub fn gen_directory_service(p: &Path) -> impl DirectoryService + Send + Sync + Clone + 'static { - SledDirectoryService::new(p.join("directories")).unwrap() +pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone + 'static { + SledDirectoryService::new_temporary().unwrap() } -pub fn gen_pathinfo_service(p: &Path) -> impl PathInfoService { - SledPathInfoService::new(p.join("pathinfo")).unwrap() +pub fn gen_pathinfo_service() -> impl PathInfoService { + SledPathInfoService::new_temporary().unwrap() } |