From e2bc2f1ce93cc34f793398e2c70ed20f6258c2aa Mon Sep 17 00:00:00 2001 From: Jan Doms Date: Tue, 6 Dec 2016 17:18:00 +0100 Subject: [PATCH] fix proxy_osd test_assert (equivalent of https://github.com/openvstorage/alba/pull/481) --- ocaml/src/proxy_osd.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ocaml/src/proxy_osd.ml b/ocaml/src/proxy_osd.ml index 7b8fbf8a..9a2d920d 100644 --- a/ocaml/src/proxy_osd.ml +++ b/ocaml/src/proxy_osd.ml @@ -404,15 +404,19 @@ class t List.map2 (fun assert_ mf_v_o -> let open Proxy_protocol.Protocol in + let failed_assert key = Osd.Error.(lwt_fail (Assert_failed (Slice.get_string_unsafe key))) in match assert_, mf_v_o with | Osd.Assert.Value (key, None), None -> Lwt.return (Assert.ObjectDoesNotExist (Slice.get_string_unsafe key)) | Osd.Assert.Value (key, None), Some _ - | Osd.Assert.Value (key, Some _), None -> - Osd.Error.(lwt_fail (Assert_failed (Slice.get_string_unsafe key))) + | Osd.Assert.Value (key, Some _), None -> + failed_assert key | Osd.Assert.Value (key, Some v), Some (mf, v') -> - Lwt.return (Assert.ObjectHasId (Slice.get_string_unsafe key, - mf.Nsm_model.Manifest.object_id))) + if Osd.Blob.(equal (Bigslice v') v) + then Lwt.return (Assert.ObjectHasId (Slice.get_string_unsafe key, + mf.Nsm_model.Manifest.object_id)) + else failed_assert key + ) asserts values |> Lwt_list.map_s Std.id )