Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb-backend-go
Commits
4fa30923
Commit
4fa30923
authored
Mar 20, 2020
by
Sonja Happ
Browse files
fixes for healthz endpoint and testing
parent
5faa768b
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
routes/healthz/healthz_endpoint.go
View file @
4fa30923
...
...
@@ -55,8 +55,8 @@ func getHealth(c *gin.Context) {
}
// check if connection to AMQP broker is alive if backend was started with AMQP client
url
,
err
:=
configuration
.
GolbalConfig
.
String
(
"amqp.
url
"
)
if
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
"Required setting 'amqp.
url
' not set"
)
{
url
,
err
:=
configuration
.
GolbalConfig
.
String
(
"amqp.
host
"
)
if
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
"Required setting 'amqp.
host
' not set"
)
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{})
return
}
else
if
err
!=
nil
{
...
...
routes/healthz/healthz_test.go
View file @
4fa30923
...
...
@@ -67,10 +67,10 @@ func TestHealthz(t *testing.T) {
assert
.
NoError
(
t
,
err
)
assert
.
Equalf
(
t
,
500
,
code
,
"Response body:
\n
%v
\n
"
,
resp
)
// connect AMQP client (make sure that AMQP_
URL is
set via command line parameter
-amqp
)
url
,
err
:=
configuration
.
GolbalConfig
.
String
(
"amqp.
url
"
)
// connect AMQP client (make sure that AMQP_
HOST, AMQP_USER, AMQP_PASS are
set via command line parameter
s
)
host
,
err
:=
configuration
.
GolbalConfig
.
String
(
"amqp.
host
"
)
assert
.
NoError
(
t
,
err
)
err
=
amqp
.
ConnectAMQP
(
url
)
err
=
amqp
.
ConnectAMQP
(
host
)
assert
.
NoError
(
t
,
err
)
// test healthz endpoint for connected DB and AMQP client
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment