diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:47:47 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:47:47 -0300 |
| commit | 41e5d7b8884f23a1e6b7991d1ffcd548d04c9560 (patch) | |
| tree | 25a4fd8616f24706523ab1394b514be290a45c21 /test/Helpers.ml | |
| parent | 41c6334bf21b1cbae228b1d75bf3d095ba84bcca (diff) | |
| download | RNT-41e5d7b8884f23a1e6b7991d1ffcd548d04c9560.tar.gz RNT-41e5d7b8884f23a1e6b7991d1ffcd548d04c9560.zip | |
fix tests
Diffstat (limited to '')
| -rw-r--r-- | test/Helpers.ml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/Helpers.ml b/test/Helpers.ml index 784170c..e859932 100644 --- a/test/Helpers.ml +++ b/test/Helpers.ml @@ -8,7 +8,7 @@ let rec recursively_remove path = else Sys.remove path let with_temporary_directory prefix ?(suffix = "") f = - let path = Filename.temp_dir ~temp_dir:"/tmp" prefix suffix in + let path = Filename.temp_dir ~temp_dir:(Filename.get_temp_dir_name ()) prefix suffix in Fun.protect (fun () -> f path) ~finally:(fun () -> recursively_remove path) let condition_as_failure = function @@ -31,12 +31,18 @@ module Storage = struct end module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct + module SI = Kernel.Storage.Make (S) + + let store_schema tx attributes = + Concepts.Encoding.Bencode.(Dict (List.map (fun a -> (a, String "string")) attributes) |> to_blob) + |> SI.store_blob tx + let with_connection f dir () = with_temporary_directory dir begin fun dir -> begin let open Utilities.Result in let* conn = S.connect (C.configure dir) in - Ok (f conn) + Ok (Fun.protect ~finally:(fun () -> S.disconnect conn) (fun () -> f conn)) end |> condition_as_failure end |
