Fix sys/health tests

This commit is contained in:
Calvin Leung Huang 2018-01-18 10:00:28 -05:00
parent 8ec1c91408
commit 7752ebe45e
1 changed files with 31 additions and 24 deletions

View File

@ -8,6 +8,7 @@ import (
"reflect"
"testing"
"github.com/hashicorp/vault/helper/consts"
"github.com/hashicorp/vault/vault"
)
@ -23,10 +24,11 @@ func TestSysHealth_get(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"replication_dr_secondary": false,
"initialized": false,
"sealed": true,
"standby": true,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": false,
"sealed": true,
"standby": true,
}
testResponseStatus(t, resp, 501)
testResponseBody(t, resp, &actual)
@ -54,10 +56,11 @@ func TestSysHealth_get(t *testing.T) {
actual = map[string]interface{}{}
expected = map[string]interface{}{
"replication_dr_secondary": false,
"initialized": true,
"sealed": true,
"standby": true,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": true,
"sealed": true,
"standby": true,
}
testResponseStatus(t, resp, 503)
testResponseBody(t, resp, &actual)
@ -89,10 +92,11 @@ func TestSysHealth_get(t *testing.T) {
actual = map[string]interface{}{}
expected = map[string]interface{}{
"replication_dr_secondary": false,
"initialized": true,
"sealed": false,
"standby": false,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": true,
"sealed": false,
"standby": false,
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
@ -130,10 +134,11 @@ func TestSysHealth_customcodes(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"replication_dr_secondary": false,
"initialized": false,
"sealed": true,
"standby": true,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": false,
"sealed": true,
"standby": true,
}
testResponseStatus(t, resp, 581)
testResponseBody(t, resp, &actual)
@ -162,10 +167,11 @@ func TestSysHealth_customcodes(t *testing.T) {
actual = map[string]interface{}{}
expected = map[string]interface{}{
"replication_dr_secondary": false,
"initialized": true,
"sealed": true,
"standby": true,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": true,
"sealed": true,
"standby": true,
}
testResponseStatus(t, resp, 523)
testResponseBody(t, resp, &actual)
@ -198,10 +204,11 @@ func TestSysHealth_customcodes(t *testing.T) {
actual = map[string]interface{}{}
expected = map[string]interface{}{
"replication_dr_secondary": false,
"initialized": true,
"sealed": false,
"standby": false,
"replication_perf_mode": consts.ReplicationDisabled.String(),
"replication_dr_mode": consts.ReplicationDisabled.String(),
"initialized": true,
"sealed": false,
"standby": false,
}
testResponseStatus(t, resp, 202)
testResponseBody(t, resp, &actual)