mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 21:48:18 -08:00
add health endpoint test without authentication
This commit is contained in:
parent
64236c99c9
commit
3953b116c7
1 changed files with 15 additions and 0 deletions
|
|
@ -16,6 +16,8 @@ import (
|
|||
"github.com/gabehf/koito/internal/db/psql"
|
||||
"github.com/gabehf/koito/internal/utils"
|
||||
"github.com/ory/dockertest/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var store *psql.Psql
|
||||
|
|
@ -142,3 +144,16 @@ func TestMain(m *testing.M) {
|
|||
func host() string {
|
||||
return fmt.Sprintf("http://%s", cfg.ListenAddr())
|
||||
}
|
||||
func TestHealthEndpointNoAuth(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s/apis/web/v1/health", host())
|
||||
resp, err := client.Get(url)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, resp)
|
||||
defer resp.Body.Close()
|
||||
|
||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue