From 7b3f10b08db92800632e3a7f00dc3bc7fddea795 Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Thu, 13 Feb 2025 11:36:52 +0100 Subject: [PATCH] roachtest: log queried URL in HealthStatus --- pkg/cmd/roachtest/cluster.go | 10 +++++++--- pkg/cmd/roachtest/test_runner.go | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/cmd/roachtest/cluster.go b/pkg/cmd/roachtest/cluster.go index 3c9ae1d893bf..13bdeded80b7 100644 --- a/pkg/cmd/roachtest/cluster.go +++ b/pkg/cmd/roachtest/cluster.go @@ -1501,14 +1501,18 @@ func selectedNodesOrDefault( type HealthStatusResult struct { Node int + URL string Status int Body []byte Err error } -func newHealthStatusResult(node int, status int, body []byte, err error) *HealthStatusResult { +func newHealthStatusResult( + node int, url string, status int, body []byte, err error, +) *HealthStatusResult { return &HealthStatusResult{ Node: node, + URL: url, Status: status, Body: body, Err: err, @@ -1538,13 +1542,13 @@ func (c *clusterImpl) HealthStatus( url := fmt.Sprintf(`%s://%s/health?ready=1`, protocol, adminAddrs[nodeIndex]) resp, err := client.Get(ctx, url) if err != nil { - return newHealthStatusResult(node, 0, nil, err) + return newHealthStatusResult(node, url, 0, nil, err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) - return newHealthStatusResult(node, resp.StatusCode, body, err) + return newHealthStatusResult(node, url, resp.StatusCode, body, err) } results := make([]*HealthStatusResult, nodeCount) diff --git a/pkg/cmd/roachtest/test_runner.go b/pkg/cmd/roachtest/test_runner.go index 45af3dabbcea..c815e5ddbc4c 100644 --- a/pkg/cmd/roachtest/test_runner.go +++ b/pkg/cmd/roachtest/test_runner.go @@ -1494,19 +1494,19 @@ func (r *testRunner) postTestAssertions( validationNode := 0 for _, s := range statuses { if s.Err != nil { - t.L().Printf("n%d:/health?ready=1 error=%s", s.Node, s.Err) + t.L().Printf("n%d: %s error=%s", s.Node, s.URL, s.Err) continue } if s.Status != http.StatusOK { - t.L().Printf("n%d:/health?ready=1 status=%d body=%s", s.Node, s.Status, s.Body) + t.L().Printf("n%d: %s status=%d body=%s", s.Node, s.URL, s.Status, s.Body) continue } if validationNode == 0 { validationNode = s.Node // NB: s.Node is never zero } - t.L().Printf("n%d:/health?ready=1 status=200 ok", s.Node) + t.L().Printf("n%d: %s status=200 ok", s.Node, s.URL) } // We avoid trying to do this when t.Failed() (and in particular when there