From c5cf36f34840731cbf6ab3012dd2d29177bf3cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarl=20Andr=C3=A9=20H=C3=BCbenthal?= Date: Fri, 13 Oct 2023 10:04:02 +0200 Subject: [PATCH] keep ryuk alive --- lib/reaper.ex | 5 +++-- test/simple_test.exs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/reaper.ex b/lib/reaper.ex index 7e15dbd..b7546fe 100644 --- a/lib/reaper.ex +++ b/lib/reaper.ex @@ -30,7 +30,8 @@ defmodule TestcontainersElixir.Reaper do {:ok, %Model.ContainerInspectResponse{} = container_info} <- Api.Container.container_inspect(connection, container_id), container = Container.of(container_info), - {:ok, socket} <- create_ryuk_socket(container) do + {:ok, socket} <- create_ryuk_socket(container), + :ok <- register_filter(socket, {"id", "keep_ryuk_alive"}) do {:ok, socket} end end @@ -60,7 +61,7 @@ defmodule TestcontainersElixir.Reaper do # FIXME this will surely not work for all use cases Binds: ["/var/run/docker.sock:/var/run/docker.sock:rw"] }, - Env: ["RYUK_PORT=#{@ryuk_port}"] + Env: ["RYUK_PORT=#{@ryuk_port}", "RYUK_CONNECTION_TIMEOUT=120s"] }) end diff --git a/test/simple_test.exs b/test/simple_test.exs index e70ecb8..c5431e6 100644 --- a/test/simple_test.exs +++ b/test/simple_test.exs @@ -8,7 +8,7 @@ defmodule SimpleTest do {:ok, container} = container(image: "nginx:latest", port: 80) port = Container.mapped_port(container, 80) - PortChecker.wait_for_port("localhost", port, 5000) + {:ok, :port_is_open} = PortChecker.wait_for_port("localhost", port, 5000) {:ok, 200, _headers, body_ref} = :hackney.get("http://localhost:#{port}") {:ok, body} = :hackney.body(body_ref)