Fix sys/health tests

This commit is contained in:
Calvin Leung Huang
2018-01-18 10:00:28 -05:00
parent c60f00869f
commit de46ae8905

View File

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