From 565e79344f28c99bd0c32df84d8244eaae454e46 Mon Sep 17 00:00:00 2001 From: "Chris S. Kim" Date: Thu, 21 Sep 2023 17:10:53 -0400 Subject: [PATCH] Dump response body on fail (#18962) --- agent/metrics_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agent/metrics_test.go b/agent/metrics_test.go index 113699fa0e..fd4f9f8d2e 100644 --- a/agent/metrics_test.go +++ b/agent/metrics_test.go @@ -487,6 +487,13 @@ func TestHTTPHandlers_AgentMetrics_WAL_Prometheus(t *testing.T) { recordPromMetrics(t, a, respRec) out := respRec.Body.String() + defer func() { + if t.Failed() { + t.Log("--- Failed output START ---") + t.Log(out) + t.Log("--- Failed output END ---") + } + }() require.Contains(t, out, "agent_5_raft_wal_head_truncations") require.Contains(t, out, "agent_5_raft_wal_last_segment_age_seconds") require.Contains(t, out, "agent_5_raft_wal_log_appends") @@ -587,6 +594,13 @@ func TestHTTPHandlers_AgentMetrics_LogVerifier_Prometheus(t *testing.T) { recordPromMetrics(t, a, respRec) out := respRec.Body.String() + defer func() { + if t.Failed() { + t.Log("--- Failed output START ---") + t.Log(out) + t.Log("--- Failed output END ---") + } + }() require.Contains(t, out, "agent_5_raft_logstore_verifier_checkpoints_written") require.Contains(t, out, "agent_5_raft_logstore_verifier_dropped_reports") require.Contains(t, out, "agent_5_raft_logstore_verifier_ranges_verified")