[misc] Fail joinClient setup through require rather than t.Fatalf

Review point on #7239: the two setup checks in joinClient reported through
t.Fatalf while every other check in the suite goes through require. Same
outcome, one less shape to read.

The WaitProxyPeer check stays behind an if rather than being passed straight
to require.NoError: the message interpolates the proxy container's whole log,
and require evaluates its arguments before it knows the assertion passed. As
written the fetch happens only on the failure it exists to explain.
This commit is contained in:
mlsmaycon
2026-08-22 11:24:51 +00:00
parent 21926b9457
commit 04a3657b7e

View File

@@ -158,11 +158,13 @@ func joinClient(t *testing.T, ctx context.Context, px *harness.Proxy, endpoint,
t.Cleanup(func() { _ = cl.Terminate(context.Background()) })
require.NoError(t, cl.WaitConnected(ctx, 90*time.Second), "second client must connect to management")
if _, err := cl.ResolveProxyIP(ctx, endpoint); err != nil {
t.Fatalf("second client could not resolve the endpoint: %v", err)
}
_, err = cl.ResolveProxyIP(ctx, endpoint)
require.NoError(t, err, "second client could not resolve the endpoint")
// Guarded rather than passed straight to require: px.Logs pulls the whole
// proxy container log, which is only worth fetching when the wait failed.
if err := cl.WaitProxyPeer(ctx, 180*time.Second); err != nil {
t.Fatalf("second client did not see the proxy peer: %v\n=== proxy logs ===\n%s", err, px.Logs(context.Background()))
require.NoError(t, err, "second client did not see the proxy peer\n=== proxy logs ===\n%s",
px.Logs(context.Background()))
}
return cl
}