github.com/msales/pkg/v3@v3.24.0/health/server_test.go (about) 1 package health_test 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/msales/pkg/v3/health" 8 "github.com/msales/pkg/v3/httpx" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestStartServer(t *testing.T) { 13 r := &testReporter{} 14 15 go health.StartServer("127.0.0.1:8080", r) 16 defer health.StopServer() 17 18 time.Sleep(time.Millisecond) 19 20 resp, err := httpx.Get("http://127.0.0.1:8080/health") 21 assert.NoError(t, err) 22 assert.Equal(t, 200, resp.StatusCode) 23 }