diff options
Diffstat (limited to 'test/unit')
| -rw-r--r-- | test/unit/backend/Storage.ml | 27 |
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"] |
