Skip to content

Commit

Permalink
make test more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Oct 6, 2023
1 parent 3ea69bf commit 400abf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ end = struct
io_assert "Can't check expiration timeout for key"
(function None -> false | Some x -> x >= 4 && x <= 6) >>= fun () ->

let pexpiry = int_of_float (Unix.time ()) * 1000 + 1000 in
let pexpiry = int_of_float (Unix.gettimeofday () *. 1000. +. 1000.) in
Client.pexpireat conn key pexpiry >>=
io_assert "Can't set expiration timeout for key (in ms)" ((=) true) >>= fun () ->
Client.pttl conn key >>| function
| Some pttl ->
assert_bool "Expiration timeout differs from setted" (0 <= pttl && pttl <= 1000)
assert_bool (Printf.sprintf "Expiration timeout differs from setted (by %dms)" pttl) (0 <= pttl && pttl <= 1000)
| None ->
assert_failure "Can't check expiration timeout for key"

Expand Down

0 comments on commit 400abf1

Please sign in to comment.