Skip to content

Commit 8b40dc7

Browse files
pierre-bclaude
andcommitted
Fix integration test for health endpoint with version
Update TestHealthEndpoint to parse JSON response and verify status and version fields instead of exact string matching. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4f4ffb4 commit 8b40dc7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

integration/integration_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package integration
33
import (
44
"bytes"
55
"context"
6+
"encoding/json"
67
"fmt"
78
"io"
89
"net/http"
@@ -113,8 +114,18 @@ func TestHealthEndpoint(t *testing.T) {
113114
}
114115

115116
body, _ := io.ReadAll(resp.Body)
116-
if string(body) != `{"status":"ok"}` {
117-
t.Errorf("unexpected health response: %s", string(body))
117+
var health struct {
118+
Status string `json:"status"`
119+
Version string `json:"version"`
120+
}
121+
if err := json.Unmarshal(body, &health); err != nil {
122+
t.Fatalf("failed to parse health response: %v", err)
123+
}
124+
if health.Status != "ok" {
125+
t.Errorf("expected status 'ok', got %q", health.Status)
126+
}
127+
if health.Version == "" {
128+
t.Error("expected version to be set")
118129
}
119130
}
120131

0 commit comments

Comments
 (0)