Skip to content
Permalink
Browse files

Repair test: fail to add after closing index

  • Loading branch information...
icristescu committed Oct 14, 2019
1 parent 60a0f21 commit 29d0545311cb592bcd20c542a342038663c3d831
Showing with 7 additions and 3 deletions.
  1. +1 −0 test/irmin-pack/common.ml
  2. +1 −0 test/irmin-pack/common.mli
  3. +5 −3 test/irmin-pack/test_pack.ml
@@ -25,6 +25,7 @@ module S = struct
end

module H = Irmin.Hash.SHA1
module I = Index
module Index = Irmin_pack.Index.Make (H)
module P = Irmin_pack.Pack.File (Index) (H)
module Pack = P.Make (S)
@@ -1,5 +1,6 @@
module Dict = Irmin_pack.Dict
module H = Irmin.Hash.SHA1
module I = Index

module Index : Irmin_pack.Index.S with type key = H.t

@@ -273,9 +273,11 @@ module Pack = struct
(*close index while in use*)
t.clone_index_pack ~readonly:false >>= fun (i, r) ->
Index.close i;
Pack.find r h1 >>= fun y1 ->
Alcotest.(check (option string)) "x1" None y1;
Pack.close r
Lwt.catch
(fun () ->
Pack.find r h1 >>= fun _ ->
Alcotest.fail "Add after closing the index should not be allowed")
(function I.Closed -> Lwt.return_unit | exn -> Lwt.fail exn)

let tests =
[

0 comments on commit 29d0545

Please sign in to comment.
You can’t perform that action at this time.