47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
// >>> VEZA:BEGIN api_health_test.go
|
|
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// TestAPIHealth tests the health endpoint
|
|
// This is a minimal integration test - adjust according to your router setup
|
|
func TestAPIHealth(t *testing.T) {
|
|
// TODO: Replace with your actual router setup
|
|
// Example:
|
|
// router := setupTestRouter()
|
|
// req := httptest.NewRequest("GET", "/health", nil)
|
|
// w := httptest.NewRecorder()
|
|
// router.ServeHTTP(w, req)
|
|
//
|
|
// assert.Equal(t, http.StatusOK, w.Code)
|
|
// assert.Contains(t, w.Body.String(), "ok")
|
|
|
|
// Placeholder test
|
|
t.Skip("TODO: Implement health endpoint test with actual router")
|
|
}
|
|
|
|
// TestAPIHealthHTTP is a basic HTTP test
|
|
func TestAPIHealthHTTP(t *testing.T) {
|
|
// This test requires the API server to be running
|
|
// In CI, use docker-compose or a test server
|
|
baseURL := "http://localhost:8080"
|
|
if testing.Short() {
|
|
t.Skip("Skipping integration test in short mode")
|
|
}
|
|
|
|
resp, err := http.Get(baseURL + "/health")
|
|
if err != nil {
|
|
t.Skipf("API server not available: %v", err)
|
|
return
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
|
}
|
|
|
|
// <<< VEZA:END api_health_test.go
|