mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix healthz test
This commit is contained in:
parent
13783dd2f5
commit
ee8625dfaf
1 changed files with 5 additions and 4 deletions
|
@ -46,15 +46,16 @@ func TestHealthz(t *testing.T) {
|
|||
defer database.DBpool.Close()
|
||||
|
||||
router = gin.Default()
|
||||
api := router.Group("/api/v2")
|
||||
|
||||
RegisterHealthzEndpoint(router.Group("/healthz"))
|
||||
RegisterHealthzEndpoint(api.Group("/healthz"))
|
||||
|
||||
// close db connection
|
||||
err = database.DBpool.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// test healthz endpoint for unconnected DB and AMQP client
|
||||
code, resp, err := helper.TestEndpoint(router, "", "healthz", http.MethodGet, nil)
|
||||
code, resp, err := helper.TestEndpoint(router, "", "/api/v2/healthz", http.MethodGet, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equalf(t, 500, code, "Response body: \n%v\n", resp)
|
||||
|
||||
|
@ -64,7 +65,7 @@ func TestHealthz(t *testing.T) {
|
|||
defer database.DBpool.Close()
|
||||
|
||||
// test healthz endpoint for connected DB and unconnected AMQP client
|
||||
code, resp, err = helper.TestEndpoint(router, "", "healthz", http.MethodGet, nil)
|
||||
code, resp, err = helper.TestEndpoint(router, "", "/api/v2/healthz", http.MethodGet, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equalf(t, 500, code, "Response body: \n%v\n", resp)
|
||||
|
||||
|
@ -83,7 +84,7 @@ func TestHealthz(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
|
||||
// test healthz endpoint for connected DB and AMQP client
|
||||
code, resp, err = helper.TestEndpoint(router, "", "healthz", http.MethodGet, nil)
|
||||
code, resp, err = helper.TestEndpoint(router, "", "/api/v2/healthz", http.MethodGet, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equalf(t, 204, code, "Response body: \n%v\n", resp)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue