feat: establish Orbit models, migrations and development baseline
This commit is contained in:
21
internal/transport/httpserver/server_test.go
Normal file
21
internal/transport/httpserver/server_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package httpserver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHealthSeparatesLivenessAndReadiness(t *testing.T) {
|
||||
server := New("127.0.0.1:0", func(context.Context) error { return errors.New("internal-database-details") })
|
||||
for path, want := range map[string]int{"/health/live": 200, "/health/ready": 503, "/v1/tasks": 404} {
|
||||
rr := httptest.NewRecorder()
|
||||
server.Handler.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, path, nil))
|
||||
if rr.Code != want || strings.Contains(rr.Body.String(), "internal-database-details") {
|
||||
t.Fatalf("%s: %d %s", path, rr.Code, rr.Body.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user