Stabilize test harness and node sync e2e
Some checks failed
CI / Test (OTP 27.2 / Elixir 1.18.2) (push) Failing after 1s
CI / Test (OTP 28.4 / Elixir 1.19.4 + Marmot E2E) (push) Failing after 1s

This commit is contained in:
2026-03-17 03:46:58 +01:00
parent e557eba437
commit a1a8b30d12
3 changed files with 35 additions and 20 deletions

View File

@@ -146,7 +146,7 @@ start_node() {
PARRHESIA_IDENTITY_PATH="$identity_path" \
PARRHESIA_SYNC_PATH="$sync_path" \
MIX_ENV=prod \
mix run --no-halt >"$log_path" 2>&1 &
mix run --no-compile --no-halt >"$log_path" 2>&1 &
if [[ "$node_name" == "a" ]]; then
NODE_A_PID=$!

View File

@@ -60,12 +60,15 @@ defmodule Parrhesia.Web.TLSE2ETest do
}}
)
assert_eventually(fn ->
case nip11_request(port, ca.certfile) do
{:ok, 200} -> true
_other -> false
end
end)
assert_eventually(
fn ->
case nip11_request(port, ca.certfile) do
{:ok, 200} -> true
_other -> false
end
end,
5_000
)
first_fingerprint = server_cert_fingerprint(port)
assert first_fingerprint == TLSCerts.cert_sha256!(server_a.certfile)
@@ -75,9 +78,12 @@ defmodule Parrhesia.Web.TLSE2ETest do
assert :ok = Endpoint.reload_listener(endpoint_name, listener_id)
assert_eventually(fn ->
server_cert_fingerprint(port) == TLSCerts.cert_sha256!(server_b.certfile)
end)
assert_eventually(
fn ->
server_cert_fingerprint(port) == TLSCerts.cert_sha256!(server_b.certfile)
end,
10_000
)
end
test "mutual TLS requires a client certificate and enforces optional client pins", %{
@@ -327,17 +333,24 @@ defmodule Parrhesia.Web.TLSE2ETest do
:"#{prefix}_#{System.unique_integer([:positive, :monotonic])}"
end
defp assert_eventually(fun, attempts \\ 40)
defp assert_eventually(_fun, 0), do: flunk("condition was not met in time")
defp assert_eventually(fun, timeout_ms) do
deadline = System.monotonic_time(:millisecond) + timeout_ms
do_assert_eventually(fun, deadline, timeout_ms, 50)
end
defp assert_eventually(fun, attempts) do
if fun.() do
:ok
else
receive do
after
50 -> assert_eventually(fun, attempts - 1)
end
defp do_assert_eventually(fun, deadline, timeout_ms, interval_ms) do
cond do
fun.() ->
:ok
System.monotonic_time(:millisecond) >= deadline ->
flunk("condition was not met in time (#{timeout_ms} ms)")
true ->
receive do
after
interval_ms -> do_assert_eventually(fun, deadline, timeout_ms, interval_ms)
end
end
end
end

View File

@@ -5,4 +5,6 @@ exclude_tags =
[:nak_e2e]
end
{:ok, _apps} = Application.ensure_all_started(:parrhesia)
ExUnit.start(exclude: exclude_tags)