Files
canada-kaktus/internal/health_test.go
Tobias Trabelsi d3682557b1
All checks were successful
Gitea Docker Build Demo / Test (push) Successful in 1m2s
Gitea Docker Build Demo / Build_Image (push) Successful in 1m22s
cleanup and refactor health service
2025-10-07 11:13:15 +02:00

25 lines
516 B
Go

package internal
import (
"net/http"
"strings"
"testing"
)
func TestHealth(t *testing.T) {
hs := NewHealthServer()
go func() {
hs.Start()
}()
request, _ := http.NewRequest(http.MethodGet, "http://localhost:8080/health", strings.NewReader(""))
resp, err := http.DefaultClient.Do(request)
if err != nil {
t.Errorf("Health endpoint did not start: %v", err)
}
if resp.StatusCode != http.StatusOK {
t.Errorf("Bad response from health endpoint. Want: %d, got %d", http.StatusOK, resp.StatusCode)
}
}