aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-08-01 00:30:46 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-08-01 00:30:46 +0000
commita26d8bbd4dd854c17a57d38ef8d8fa0361cc5d7c (patch)
tree41fc4e2efff3db73f65d4f9d031e113c52d472a0 /test/unit
parentb60c67be7aaddb1a45a747bc6ac0402ab5d3a945 (diff)
downloadRNT-a26d8bbd4dd854c17a57d38ef8d8fa0361cc5d7c.tar.gz
RNT-a26d8bbd4dd854c17a57d38ef8d8fa0361cc5d7c.zip
Move storage-related helpers to `Helpers`
Diffstat (limited to '')
-rw-r--r--test/unit/backend/Storage.ml27
1 files changed, 4 insertions, 23 deletions
diff --git a/test/unit/backend/Storage.ml b/test/unit/backend/Storage.ml
index 91db411..76bda8b 100644
--- a/test/unit/backend/Storage.ml
+++ b/test/unit/backend/Storage.ml
@@ -1,21 +1,9 @@
open Rnt
-module type CONFIGURATOR = sig
- val configure : string -> Rnt.Concepts.Configuration.term
-end
-
-module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct
+module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = struct
open Alcotest
- let with_connection f () =
- Helpers.with_temporary_directory "storage-test" begin fun dir ->
- begin
- let open Utilities.Result in
- let* conn = S.connect (C.configure dir) in
- Ok (f conn)
- end
- |> Helpers.condition_as_failure
- end
+ module H = Helpers.Storage.Make (S) (C)
let storage_and_retrieval conn =
let key = Concepts.Hash.hash_of_value (Concepts.Value.String "value") in
@@ -38,16 +26,9 @@ module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct
let suite prefix =
( "storage/" ^ prefix,
- [test_case "storage-and-retrieval" `Quick (with_connection storage_and_retrieval)] )
-end
-
-module LMDB_Configurator : CONFIGURATOR = struct
- let configure base =
- let open Sexplib.Sexp in
- List [Atom "lmdb"; List [Atom "path"; Atom base]; List [Atom "mode"; Atom "420"]]
- |> Rnt.Concepts.Configuration.term_of_sexp
+ [test_case "storage-and-retrieval" `Quick (H.with_connection storage_and_retrieval "storage-test")] )
end
-module LMDB = Make (Rnt.Backend.Storage.LMDB) (LMDB_Configurator)
+module LMDB = Make (Rnt.Backend.Storage.LMDB) (Helpers.Storage.LMDB_Configurator)
let suites () = [LMDB.suite "lmdb"]