Skip to content

Commit

Permalink
roachtest: log queried URL in HealthStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg committed Feb 13, 2025
1 parent ea532f1 commit cfb1b1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1501,14 +1501,16 @@ 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,
Expand Down Expand Up @@ -1538,13 +1540,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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ func (r *testRunner) postTestAssertions(
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.URL, s.Node)
}

// We avoid trying to do this when t.Failed() (and in particular when there
Expand Down

0 comments on commit cfb1b1e

Please sign in to comment.