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_IDENTITY_PATH="$identity_path" \
PARRHESIA_SYNC_PATH="$sync_path" \ PARRHESIA_SYNC_PATH="$sync_path" \
MIX_ENV=prod \ 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 if [[ "$node_name" == "a" ]]; then
NODE_A_PID=$! NODE_A_PID=$!

View File

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

View File

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