Files
dance-lessons-coach/pkg/bdd/steps/health_steps.go
Gabriel Radureau 4bbf68ebea feat(server): add /api/healthz endpoint with rich health info
Adds a Kubernetes-style healthz endpoint returning status, version,
uptime_seconds and timestamp. Non-breaking — /api/health is preserved.

- New route: GET /api/healthz
- New handler: handleHealthz with HealthzResponse struct
- New unit test: pkg/server/healthz_test.go (passes locally)
- New BDD scenario: features/health/health.feature
- BDD steps: pkg/bdd/steps/health_steps.go, common_steps.go

Note: BDD tests require Postgres and will be validated by CI.

🤖 Co-Authored-By: Mistral Vibe (devstral-2 / mistral-medium-3.5)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 12:25:24 +02:00

35 lines
927 B
Go

package steps
import (
"dance-lessons-coach/pkg/bdd/testserver"
)
// HealthSteps holds health-related step definitions
type HealthSteps struct {
client *testserver.Client
scenarioKey string // Track current scenario for state isolation
}
func NewHealthSteps(client *testserver.Client) *HealthSteps {
return &HealthSteps{client: client}
}
// SetScenarioKey sets the current scenario key for state isolation
func (s *HealthSteps) SetScenarioKey(key string) {
s.scenarioKey = key
}
// Health-related steps
func (s *HealthSteps) iRequestTheHealthEndpoint() error {
return s.client.Request("GET", "/api/health", nil)
}
func (s *HealthSteps) iRequestTheHealthzEndpoint() error {
return s.client.Request("GET", "/api/healthz", nil)
}
func (s *HealthSteps) theServerIsRunning() error {
// Actually verify the server is running by checking the readiness endpoint
return s.client.Request("GET", "/api/ready", nil)
}