summaryrefslogtreecommitdiffstats
path: root/api4/system_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-05-31 06:47:27 +0200
committerCorey Hulen <corey@hulen.com>2017-05-30 21:47:27 -0700
commitddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7 (patch)
tree630c8b7b3970b2e79a5888fb9cd2c1722638cfbd /api4/system_test.go
parent0e4add96aebbd85d8ca7390ecc8b50ead9dbefac (diff)
downloadchat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.tar.gz
chat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.tar.bz2
chat-ddc996f33fc39b2b8f4705d6e1232ccbad1ee4c7.zip
[PLT-5465/APIV4] GET /system/health - Improve ping health check to have limits (#6331)
* implement PLT-5465 - Improve ping health check to have limits * update /ping and delete /health * remove permission check
Diffstat (limited to 'api4/system_test.go')
-rw-r--r--api4/system_test.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/api4/system_test.go b/api4/system_test.go
index a6b12d326..a46e14782 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -12,13 +12,26 @@ import (
)
func TestGetPing(t *testing.T) {
- th := Setup().InitBasic()
+ th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
Client := th.Client
- b, _ := Client.GetPing()
- if b == false {
- t.Fatal()
+ goRoutineHealthThreshold := *utils.Cfg.ServiceSettings.GoroutineHealthThreshold
+ defer func() {
+ *utils.Cfg.ServiceSettings.GoroutineHealthThreshold = goRoutineHealthThreshold
+ }()
+
+ status, resp := Client.GetPing()
+ CheckNoError(t, resp)
+ if status != "OK" {
+ t.Fatal("should return OK")
+ }
+
+ *utils.Cfg.ServiceSettings.GoroutineHealthThreshold = 10
+ status, resp = th.SystemAdminClient.GetPing()
+ CheckInternalErrorStatus(t, resp)
+ if status != "unhealthy" {
+ t.Fatal("should return unhealthy")
}
}
@@ -342,5 +355,4 @@ func TestPostLog(t *testing.T) {
if len(logMessage) == 0 {
t.Fatal("should return the log message")
}
-
}