feature/tt/initial-implementation (#1)
Reviewed-on: #1 Co-authored-by: Tobias Trabelsi <lerentis@uploadfilter24.eu> Co-committed-by: Tobias Trabelsi <lerentis@uploadfilter24.eu>
This commit is contained in:
23
internal/health_test.go
Normal file
23
internal/health_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user