|
|
@ -48,8 +48,9 @@ func prepareTestDb(t *testing.T) *sqlx.DB {
|
|
|
|
return dbx
|
|
|
|
return dbx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func StartTestTcpServer(t *testing.T) int {
|
|
|
|
func StartTestTCPServer(t *testing.T) int {
|
|
|
|
t.Helper()
|
|
|
|
t.Helper()
|
|
|
|
|
|
|
|
|
|
|
|
port, err := tcputil.EmptyPort()
|
|
|
|
port, err := tcputil.EmptyPort()
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
|
|
|
@ -68,6 +69,7 @@ func StartTestTcpServer(t *testing.T) int {
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("could not accept connection: %v", err)
|
|
|
|
t.Errorf("could not accept connection: %v", err)
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +83,7 @@ func StartTestTcpServer(t *testing.T) int {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestApplication_healthCheck(t *testing.T) {
|
|
|
|
func TestApplication_healthCheck(t *testing.T) {
|
|
|
|
port := StartTestTcpServer(t)
|
|
|
|
port := StartTestTCPServer(t)
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("check with valid DB", func(t *testing.T) {
|
|
|
|
t.Run("check with valid DB", func(t *testing.T) {
|
|
|
|
rr := httptest.NewRecorder()
|
|
|
|
rr := httptest.NewRecorder()
|
|
|
|