Fix TestParseSockaddrTemplate to take into account CustomResponseHeaders. (#12902)

This commit is contained in:
Nick Cabatoff
2021-10-22 08:50:12 -04:00
committed by GitHub
parent fd76783fa5
commit bf9aa3235f

View File

@@ -16,7 +16,7 @@ import (
"github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/internalshared/configutil"
) )
var DefaultCustomHeaders = map[string]map[string]string { var DefaultCustomHeaders = map[string]map[string]string{
"default": { "default": {
"Strict-Transport-Security": configutil.StrictTransportSecurity, "Strict-Transport-Security": configutil.StrictTransportSecurity,
}, },
@@ -36,8 +36,8 @@ func testConfigRaftRetryJoin(t *testing.T) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:8200", Address: "127.0.0.1:8200",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -69,8 +69,8 @@ func testLoadConfigFile_topLevel(t *testing.T, entropy *configutil.Entropy) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -180,13 +180,13 @@ func testLoadConfigFile_json2(t *testing.T, entropy *configutil.Entropy) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:444", Address: "127.0.0.1:444",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -344,8 +344,8 @@ func testLoadConfigFileIntegerAndBooleanValuesCommon(t *testing.T, path string)
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:8200", Address: "127.0.0.1:8200",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -388,8 +388,8 @@ func testLoadConfigFile(t *testing.T) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -535,8 +535,8 @@ func testLoadConfigFile_json(t *testing.T) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -621,8 +621,8 @@ func testLoadConfigDir(t *testing.T) {
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -866,10 +866,11 @@ EOF
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
ClusterAddress: "127.0.0.1:8201", ClusterAddress: "127.0.0.1:8201",
TLSDisable: true, TLSDisable: true,
CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
}, },
@@ -895,8 +896,8 @@ func testParseSeals(t *testing.T) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },
@@ -949,8 +950,8 @@ func testLoadConfigFileLeaseMetrics(t *testing.T) {
SharedConfig: &configutil.SharedConfig{ SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{ Listeners: []*configutil.Listener{
{ {
Type: "tcp", Type: "tcp",
Address: "127.0.0.1:443", Address: "127.0.0.1:443",
CustomResponseHeaders: DefaultCustomHeaders, CustomResponseHeaders: DefaultCustomHeaders,
}, },
}, },