24 lines
502 B
Go
24 lines
502 B
Go
package internal
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestHealth(t *testing.T) {
|
|
go func() {
|
|
StartHealthEndpoint()
|
|
}()
|
|
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)
|
|
}
|
|
}
|