Skip to content

Commit

Permalink
xapi-guard/test: Count file descriptors
Browse files Browse the repository at this point in the history
The test is commented out because under certain conditions which
couldn't be replicated at the end there are _less_ file descriptors that
at the beginning.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@citrix.com>
  • Loading branch information
edwintorok authored and psafont committed Oct 20, 2022
1 parent 091143e commit d15b774
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ocaml/xapi-guard/test/xapi_guard_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,18 @@ let bad_params_tests =
]
)

let test_shutdown _ () = Lwt_switch.turn_off Varstored_interface.shutdown
let linux_count_fds () = Sys.readdir "/proc/self/fd" |> Array.length

let test_shutdown _ () =
let _fd0 = linux_count_fds () in
let noop ~rpc:_ ~session_id:_ () = Lwt.return_unit in
let* () = with_rpc noop Varstored_interface.shutdown () in
let* () = Lwt_switch.turn_off Varstored_interface.shutdown in
let _fd1 = linux_count_fds () in
(* Sometimes fd1 is lower than fd0, feel free to find the root cause and
uncomment the test! *)
(* Alcotest.(check' int) ~msg:"No FD leak" ~expected:_fd0 ~actual:_fd1 ; *)
Lwt.return_unit

let shutdown_tests = ("Shutdown", [test_case "shutdown" `Quick test_shutdown])

Expand Down

0 comments on commit d15b774

Please sign in to comment.