From 04a3657b7e5835da952a9dbbe08a3876d7fc1c5b Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Sat, 22 Aug 2026 11:24:51 +0000 Subject: [PATCH] [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. --- e2e/agentnetwork/discovery_multipolicy_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e/agentnetwork/discovery_multipolicy_test.go b/e2e/agentnetwork/discovery_multipolicy_test.go index 61b3a0d93..447c1314c 100644 --- a/e2e/agentnetwork/discovery_multipolicy_test.go +++ b/e2e/agentnetwork/discovery_multipolicy_test.go @@ -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 }