mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 10:37:56 +00:00 
			
		
		
		
	Stop passing in loggers to clusters explicitly (#21999)
This commit is contained in:
		| @@ -8,10 +8,8 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	hclog "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
| @@ -104,9 +102,7 @@ func TestBackend_E2E_Initialize(t *testing.T) { | |||||||
|  |  | ||||||
| func setupAwsTestCluster(t *testing.T, _ context.Context) *vault.TestCluster { | func setupAwsTestCluster(t *testing.T, _ context.Context) *vault.TestCluster { | ||||||
| 	// create a cluster with the aws auth backend built-in | 	// create a cluster with the aws auth backend built-in | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"aws": Factory, | 			"aws": Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -27,25 +27,21 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-sockaddr" |  | ||||||
|  |  | ||||||
| 	"github.com/go-test/deep" | 	"github.com/go-test/deep" | ||||||
| 	"golang.org/x/net/http2" |  | ||||||
|  |  | ||||||
| 	cleanhttp "github.com/hashicorp/go-cleanhttp" | 	cleanhttp "github.com/hashicorp/go-cleanhttp" | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" |  | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" |  | ||||||
|  |  | ||||||
| 	rootcerts "github.com/hashicorp/go-rootcerts" | 	rootcerts "github.com/hashicorp/go-rootcerts" | ||||||
|  | 	"github.com/hashicorp/go-sockaddr" | ||||||
|  | 	"github.com/hashicorp/vault/api" | ||||||
| 	"github.com/hashicorp/vault/builtin/logical/pki" | 	"github.com/hashicorp/vault/builtin/logical/pki" | ||||||
| 	logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical" | 	logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical" | ||||||
|  | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/framework" | 	"github.com/hashicorp/vault/sdk/framework" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/certutil" | 	"github.com/hashicorp/vault/sdk/helper/certutil" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/tokenutil" | 	"github.com/hashicorp/vault/sdk/helper/tokenutil" | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| 	"github.com/mitchellh/mapstructure" | 	"github.com/mitchellh/mapstructure" | ||||||
|  | 	"golang.org/x/net/http2" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -253,9 +249,6 @@ func connectionState(serverCAPath, serverCertPath, serverKeyPath, clientCertPath | |||||||
| func TestBackend_PermittedDNSDomainsIntermediateCA(t *testing.T) { | func TestBackend_PermittedDNSDomainsIntermediateCA(t *testing.T) { | ||||||
| 	// Enable PKI secret engine and Cert auth method | 	// Enable PKI secret engine and Cert auth method | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"cert": Factory, | 			"cert": Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -479,9 +472,6 @@ func TestBackend_PermittedDNSDomainsIntermediateCA(t *testing.T) { | |||||||
| func TestBackend_MetadataBasedACLPolicy(t *testing.T) { | func TestBackend_MetadataBasedACLPolicy(t *testing.T) { | ||||||
| 	// Start cluster with cert auth method enabled | 	// Start cluster with cert auth method enabled | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"cert": Factory, | 			"cert": Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ import ( | |||||||
| 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" | 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" | ||||||
| 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/providers" | 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/providers" | ||||||
| 	"github.com/aliyun/alibaba-cloud-sdk-go/services/sts" | 	"github.com/aliyun/alibaba-cloud-sdk-go/services/sts" | ||||||
| 	hclog "github.com/hashicorp/go-hclog" |  | ||||||
| 	uuid "github.com/hashicorp/go-uuid" | 	uuid "github.com/hashicorp/go-uuid" | ||||||
| 	vaultalicloud "github.com/hashicorp/vault-plugin-auth-alicloud" | 	vaultalicloud "github.com/hashicorp/vault-plugin-auth-alicloud" | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| @@ -25,7 +24,6 @@ import ( | |||||||
| 	"github.com/hashicorp/vault/command/agentproxyshared/sink/file" | 	"github.com/hashicorp/vault/command/agentproxyshared/sink/file" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers" | 	"github.com/hashicorp/vault/helper/testhelpers" | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
| @@ -49,9 +47,7 @@ func TestAliCloudEndToEnd(t *testing.T) { | |||||||
| 	} | 	} | ||||||
| 	testhelpers.SkipUnlessEnvVarsSet(t, credNames) | 	testhelpers.SkipUnlessEnvVarsSet(t, credNames) | ||||||
|  |  | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"alicloud": vaultalicloud.Factory, | 			"alicloud": vaultalicloud.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -91,7 +87,7 @@ func TestAliCloudEndToEnd(t *testing.T) { | |||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
| 	am, err := agentalicloud.NewAliCloudAuthMethod(&auth.AuthConfig{ | 	am, err := agentalicloud.NewAliCloudAuthMethod(&auth.AuthConfig{ | ||||||
| 		Logger:    logger.Named("auth.alicloud"), | 		Logger:    cluster.Logger.Named("auth.alicloud"), | ||||||
| 		MountPath: "auth/alicloud", | 		MountPath: "auth/alicloud", | ||||||
| 		Config: map[string]interface{}{ | 		Config: map[string]interface{}{ | ||||||
| 			"role":                     "test", | 			"role":                     "test", | ||||||
| @@ -104,7 +100,7 @@ func TestAliCloudEndToEnd(t *testing.T) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ahConfig := &auth.AuthHandlerConfig{ | 	ahConfig := &auth.AuthHandlerConfig{ | ||||||
| 		Logger: logger.Named("auth.handler"), | 		Logger: cluster.Logger.Named("auth.handler"), | ||||||
| 		Client: client, | 		Client: client, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -133,7 +129,7 @@ func TestAliCloudEndToEnd(t *testing.T) { | |||||||
| 	t.Logf("output: %s", tokenSinkFileName) | 	t.Logf("output: %s", tokenSinkFileName) | ||||||
|  |  | ||||||
| 	config := &sink.SinkConfig{ | 	config := &sink.SinkConfig{ | ||||||
| 		Logger: logger.Named("sink.file"), | 		Logger: cluster.Logger.Named("sink.file"), | ||||||
| 		Config: map[string]interface{}{ | 		Config: map[string]interface{}{ | ||||||
| 			"path": tokenSinkFileName, | 			"path": tokenSinkFileName, | ||||||
| 		}, | 		}, | ||||||
| @@ -147,7 +143,7 @@ func TestAliCloudEndToEnd(t *testing.T) { | |||||||
| 	config.Sink = fs | 	config.Sink = fs | ||||||
|  |  | ||||||
| 	ss := sink.NewSinkServer(&sink.SinkServerConfig{ | 	ss := sink.NewSinkServer(&sink.SinkServerConfig{ | ||||||
| 		Logger: logger.Named("sink.server"), | 		Logger: cluster.Logger.Named("sink.server"), | ||||||
| 		Client: client, | 		Client: client, | ||||||
| 	}) | 	}) | ||||||
| 	go func() { | 	go func() { | ||||||
|   | |||||||
| @@ -72,7 +72,6 @@ func testAppRoleEndToEnd(t *testing.T, removeSecretIDFile bool, bindSecretID boo | |||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, | 		DisableMlock: true, | ||||||
| 		DisableCache: true, | 		DisableCache: true, | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -411,9 +410,6 @@ func TestAppRoleLongRoleName(t *testing.T) { | |||||||
| 	approleName := strings.Repeat("a", 5000) | 	approleName := strings.Repeat("a", 5000) | ||||||
|  |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -477,9 +473,6 @@ func testAppRoleWithWrapping(t *testing.T, bindSecretID bool, secretIDLess bool, | |||||||
| 	var err error | 	var err error | ||||||
| 	logger := logging.NewVaultLogger(log.Trace) | 	logger := logging.NewVaultLogger(log.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -26,7 +26,6 @@ import ( | |||||||
| func TestTokenPreload_UsingAutoAuth(t *testing.T) { | func TestTokenPreload_UsingAutoAuth(t *testing.T) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -61,7 +61,6 @@ func TestAWSEndToEnd(t *testing.T) { | |||||||
|  |  | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"aws": vaultaws.Factory, | 			"aws": vaultaws.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -45,9 +45,6 @@ func TestCache_UsingAutoAuthToken(t *testing.T) { | |||||||
| 	var err error | 	var err error | ||||||
| 	logger := logging.NewVaultLogger(log.Trace) | 	logger := logging.NewVaultLogger(log.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -66,7 +66,6 @@ func TestCertEndToEnd(t *testing.T) { | |||||||
| func testCertEndToEnd(t *testing.T, withCertRoleName, ahWrapping bool) { | func testCertEndToEnd(t *testing.T, withCertRoleName, ahWrapping bool) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"cert": vaultcert.Factory, | 			"cert": vaultcert.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -306,7 +305,6 @@ func testCertEndToEnd(t *testing.T, withCertRoleName, ahWrapping bool) { | |||||||
| func TestCertEndToEnd_CertsInConfig(t *testing.T) { | func TestCertEndToEnd_CertsInConfig(t *testing.T) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"cert": vaultcert.Factory, | 			"cert": vaultcert.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -29,9 +29,6 @@ func TestCFEndToEnd(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
|  |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"cf": credCF.Factory, | 			"cf": credCF.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -55,7 +55,6 @@ func TestJWTEndToEnd(t *testing.T) { | |||||||
| func testJWTEndToEnd(t *testing.T, ahWrapping, useSymlink, removeJWTAfterReading bool) { | func testJWTEndToEnd(t *testing.T, ahWrapping, useSymlink, removeJWTAfterReading bool) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"jwt": vaultjwt.Factory, | 			"jwt": vaultjwt.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -59,7 +59,6 @@ func TestOCIEndToEnd(t *testing.T) { | |||||||
|  |  | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"oci": vaultoci.Factory, | 			"oci": vaultoci.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -21,15 +21,8 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestTokenFileEndToEnd(t *testing.T) { | func TestTokenFileEndToEnd(t *testing.T) { | ||||||
| 	var err error |  | ||||||
| 	logger := logging.NewVaultLogger(log.Trace) | 	logger := logging.NewVaultLogger(log.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ |  | ||||||
| 		HandlerFunc: vaulthttp.Handler, | 		HandlerFunc: vaulthttp.Handler, | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -107,7 +107,6 @@ func TestAgent_ExitAfterAuth(t *testing.T) { | |||||||
| func testAgentExitAfterAuth(t *testing.T, viaFlag bool) { | func testAgentExitAfterAuth(t *testing.T, viaFlag bool) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"jwt": vaultjwt.Factory, | 			"jwt": vaultjwt.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -311,7 +310,6 @@ func TestAgent_RequireRequestHeader(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -528,7 +526,6 @@ func TestAgent_Template_UserAgent(t *testing.T) { | |||||||
| 	var h userAgentHandler | 	var h userAgentHandler | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -776,7 +773,6 @@ func TestAgent_Template_Basic(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -1079,7 +1075,6 @@ func TestAgent_Template_ExitCounter(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -1436,7 +1431,6 @@ func TestAgent_Template_Retry(t *testing.T) { | |||||||
| 	var h handler | 	var h handler | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -1724,7 +1718,6 @@ func TestAgent_AutoAuth_UserAgent(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	var h userAgentHandler | 	var h userAgentHandler | ||||||
| 	cluster := vault.NewTestCluster(t, &vault.CoreConfig{ | 	cluster := vault.NewTestCluster(t, &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -2168,7 +2161,6 @@ func TestAgent_ApiProxy_Retry(t *testing.T) { | |||||||
| 	var h handler | 	var h handler | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -2320,7 +2312,6 @@ func TestAgent_TemplateConfig_ExitOnRetryFailure(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			// Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -2623,11 +2614,7 @@ func TestAgent_Metrics(t *testing.T) { | |||||||
| 	//---------------------------------------------------- | 	//---------------------------------------------------- | ||||||
|  |  | ||||||
| 	// Start a vault server | 	// Start a vault server | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	cluster := vault.NewTestCluster(t, nil, | ||||||
| 	cluster := vault.NewTestCluster(t, |  | ||||||
| 		&vault.CoreConfig{ |  | ||||||
| 			Logger: logger, |  | ||||||
| 		}, |  | ||||||
| 		&vault.TestClusterOptions{ | 		&vault.TestClusterOptions{ | ||||||
| 			HandlerFunc: vaulthttp.Handler, | 			HandlerFunc: vaulthttp.Handler, | ||||||
| 		}) | 		}) | ||||||
| @@ -2650,7 +2637,7 @@ listener "tcp" { | |||||||
| 	defer os.Remove(configPath) | 	defer os.Remove(configPath) | ||||||
|  |  | ||||||
| 	// Start the agent | 	// Start the agent | ||||||
| 	ui, cmd := testAgentCommand(t, logger) | 	ui, cmd := testAgentCommand(t, logging.NewVaultLogger(hclog.Trace)) | ||||||
| 	cmd.client = serverClient | 	cmd.client = serverClient | ||||||
| 	cmd.startedCh = make(chan struct{}) | 	cmd.startedCh = make(chan struct{}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -58,9 +58,7 @@ func (u *userpassTestMethod) Shutdown() { | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestAuthHandler(t *testing.T) { | func TestAuthHandler(t *testing.T) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"userpass": userpass.Factory, | 			"userpass": userpass.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -77,7 +75,7 @@ func TestAuthHandler(t *testing.T) { | |||||||
| 	ctx, cancelFunc := context.WithCancel(context.Background()) | 	ctx, cancelFunc := context.WithCancel(context.Background()) | ||||||
|  |  | ||||||
| 	ah := NewAuthHandler(&AuthHandlerConfig{ | 	ah := NewAuthHandler(&AuthHandlerConfig{ | ||||||
| 		Logger: logger.Named("auth.handler"), | 		Logger: logging.NewVaultLogger(hclog.Trace).Named("auth.handler"), | ||||||
| 		Client: client, | 		Client: client, | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								command/agentproxyshared/cache/api_proxy_test.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								command/agentproxyshared/cache/api_proxy_test.go
									
									
									
									
										vendored
									
									
								
							| @@ -12,18 +12,16 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/vault/helper/useragent" |  | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/vault/builtin/credential/userpass" |  | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" |  | ||||||
| 	"github.com/hashicorp/vault/vault" |  | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" | 	"github.com/hashicorp/go-hclog" | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
|  | 	"github.com/hashicorp/vault/builtin/credential/userpass" | ||||||
| 	"github.com/hashicorp/vault/helper/namespace" | 	"github.com/hashicorp/vault/helper/namespace" | ||||||
|  | 	"github.com/hashicorp/vault/helper/useragent" | ||||||
|  | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" | 	"github.com/hashicorp/vault/sdk/helper/logging" | ||||||
|  | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
|  | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const policyAdmin = ` | const policyAdmin = ` | ||||||
| @@ -188,15 +186,9 @@ func setupClusterAndAgentCommon(ctx context.Context, t *testing.T, coreConfig *v | |||||||
| 		ctx = context.Background() | 		ctx = context.Background() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Handle sane defaults |  | ||||||
| 	if coreConfig == nil { | 	if coreConfig == nil { | ||||||
| 		coreConfig = &vault.CoreConfig{ | 		coreConfig = &vault.CoreConfig{} | ||||||
| 			DisableMlock: true, |  | ||||||
| 			DisableCache: true, |  | ||||||
| 			Logger:       logging.NewVaultLogger(hclog.Trace), |  | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// Always set up the userpass backend since we use that to generate an admin | 	// Always set up the userpass backend since we use that to generate an admin | ||||||
| 	// token for the client that will make proxied requests to through the agent. | 	// token for the client that will make proxied requests to through the agent. | ||||||
| 	if coreConfig.CredentialBackends == nil || coreConfig.CredentialBackends["userpass"] == nil { | 	if coreConfig.CredentialBackends == nil || coreConfig.CredentialBackends["userpass"] == nil { | ||||||
| @@ -257,7 +249,7 @@ func setupClusterAndAgentCommon(ctx context.Context, t *testing.T, coreConfig *v | |||||||
| 		t.Fatal(err) | 		t.Fatal(err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	apiProxyLogger := logging.NewVaultLogger(hclog.Trace).Named("apiproxy") | 	apiProxyLogger := cluster.Logger.Named("apiproxy") | ||||||
|  |  | ||||||
| 	// Create the API proxier | 	// Create the API proxier | ||||||
| 	apiProxy, err := NewAPIProxy(&APIProxyConfig{ | 	apiProxy, err := NewAPIProxy(&APIProxyConfig{ | ||||||
| @@ -275,7 +267,7 @@ func setupClusterAndAgentCommon(ctx context.Context, t *testing.T, coreConfig *v | |||||||
|  |  | ||||||
| 	var leaseCache *LeaseCache | 	var leaseCache *LeaseCache | ||||||
| 	if useCache { | 	if useCache { | ||||||
| 		cacheLogger := logging.NewVaultLogger(hclog.Trace).Named("cache") | 		cacheLogger := cluster.Logger.Named("cache") | ||||||
|  |  | ||||||
| 		// Create the lease cache proxier and set its underlying proxier to | 		// Create the lease cache proxier and set its underlying proxier to | ||||||
| 		// the API proxier. | 		// the API proxier. | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								command/agentproxyshared/cache/cache_test.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										30
									
								
								command/agentproxyshared/cache/cache_test.go
									
									
									
									
										vendored
									
									
								
							| @@ -202,9 +202,6 @@ func TestCache_AutoAuthClientTokenProxyStripping(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_ConcurrentRequests(t *testing.T) { | func TestCache_ConcurrentRequests(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -247,9 +244,6 @@ func TestCache_ConcurrentRequests(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_RevokeOrphan(t *testing.T) { | func TestCache_TokenRevocations_RevokeOrphan(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -348,9 +342,6 @@ func TestCache_TokenRevocations_RevokeOrphan(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_LeafLevelToken(t *testing.T) { | func TestCache_TokenRevocations_LeafLevelToken(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -448,9 +439,6 @@ func TestCache_TokenRevocations_LeafLevelToken(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_IntermediateLevelToken(t *testing.T) { | func TestCache_TokenRevocations_IntermediateLevelToken(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -546,9 +534,6 @@ func TestCache_TokenRevocations_IntermediateLevelToken(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_TopLevelToken(t *testing.T) { | func TestCache_TokenRevocations_TopLevelToken(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -641,9 +626,6 @@ func TestCache_TokenRevocations_TopLevelToken(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_Shutdown(t *testing.T) { | func TestCache_TokenRevocations_Shutdown(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -731,9 +713,6 @@ func TestCache_TokenRevocations_Shutdown(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_TokenRevocations_BaseContextCancellation(t *testing.T) { | func TestCache_TokenRevocations_BaseContextCancellation(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -822,9 +801,6 @@ func TestCache_TokenRevocations_BaseContextCancellation(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_NonCacheable(t *testing.T) { | func TestCache_NonCacheable(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": kv.Factory, | 			"kv": kv.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -930,9 +906,6 @@ func TestCache_Caching_AuthResponse(t *testing.T) { | |||||||
|  |  | ||||||
| func TestCache_Caching_LeaseResponse(t *testing.T) { | func TestCache_Caching_LeaseResponse(t *testing.T) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| @@ -1032,9 +1005,6 @@ func TestCache_Caching_CacheClear(t *testing.T) { | |||||||
|  |  | ||||||
| func testCachingCacheClearCommon(t *testing.T, clearType string) { | func testCachingCacheClearCommon(t *testing.T, clearType string) { | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"kv": vault.LeasedPassthroughBackendFactory, | 			"kv": vault.LeasedPassthroughBackendFactory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -8,7 +8,6 @@ import ( | |||||||
| 	"sync" | 	"sync" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	auth "github.com/hashicorp/vault/api/auth/approle" | 	auth "github.com/hashicorp/vault/api/auth/approle" | ||||||
| 	credAppRole "github.com/hashicorp/vault/builtin/credential/approle" | 	credAppRole "github.com/hashicorp/vault/builtin/credential/approle" | ||||||
| @@ -20,9 +19,6 @@ import ( | |||||||
| func TestAppRole_Integ_ConcurrentLogins(t *testing.T) { | func TestAppRole_Integ_ConcurrentLogins(t *testing.T) { | ||||||
| 	var err error | 	var err error | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -21,7 +21,6 @@ import ( | |||||||
| 	"github.com/hashicorp/vault/builtin/logical/transit" | 	"github.com/hashicorp/vault/builtin/logical/transit" | ||||||
| 	"github.com/hashicorp/vault/helper/benchhelpers" | 	"github.com/hashicorp/vault/helper/benchhelpers" | ||||||
| 	"github.com/hashicorp/vault/helper/builtinplugins" | 	"github.com/hashicorp/vault/helper/builtinplugins" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/sdk/physical/inmem" | 	"github.com/hashicorp/vault/sdk/physical/inmem" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| @@ -126,9 +125,6 @@ func testVaultServerAllBackends(tb testing.TB) (*api.Client, func()) { | |||||||
| 	tb.Helper() | 	tb.Helper() | ||||||
|  |  | ||||||
| 	client, _, closer := testVaultServerCoreConfig(tb, &vault.CoreConfig{ | 	client, _, closer := testVaultServerCoreConfig(tb, &vault.CoreConfig{ | ||||||
| 		DisableMlock:       true, |  | ||||||
| 		DisableCache:       true, |  | ||||||
| 		Logger:             defaultVaultLogger, |  | ||||||
| 		CredentialBackends: credentialBackends, | 		CredentialBackends: credentialBackends, | ||||||
| 		AuditBackends:      auditBackends, | 		AuditBackends:      auditBackends, | ||||||
| 		LogicalBackends:    logicalBackends, | 		LogicalBackends:    logicalBackends, | ||||||
| @@ -156,16 +152,8 @@ func testVaultServerUnseal(tb testing.TB) (*api.Client, []string, func()) { | |||||||
|  |  | ||||||
| func testVaultServerUnsealWithKVVersionWithSeal(tb testing.TB, kvVersion string, seal vault.Seal) (*api.Client, []string, func()) { | func testVaultServerUnsealWithKVVersionWithSeal(tb testing.TB, kvVersion string, seal vault.Seal) (*api.Client, []string, func()) { | ||||||
| 	tb.Helper() | 	tb.Helper() | ||||||
| 	logger := log.NewInterceptLogger(&log.LoggerOptions{ |  | ||||||
| 		Output:     log.DefaultOutput, |  | ||||||
| 		Level:      log.Debug, |  | ||||||
| 		JSONFormat: logging.ParseEnvLogFormat() == logging.JSONFormat, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	return testVaultServerCoreConfigWithOpts(tb, &vault.CoreConfig{ | 	return testVaultServerCoreConfigWithOpts(tb, &vault.CoreConfig{ | ||||||
| 		DisableMlock:       true, |  | ||||||
| 		DisableCache:       true, |  | ||||||
| 		Logger:             logger, |  | ||||||
| 		CredentialBackends: defaultVaultCredentialBackends, | 		CredentialBackends: defaultVaultCredentialBackends, | ||||||
| 		AuditBackends:      defaultVaultAuditBackends, | 		AuditBackends:      defaultVaultAuditBackends, | ||||||
| 		LogicalBackends:    defaultVaultLogicalBackends, | 		LogicalBackends:    defaultVaultLogicalBackends, | ||||||
| @@ -185,9 +173,6 @@ func testVaultServerPluginDir(tb testing.TB, pluginDir string) (*api.Client, []s | |||||||
| 	tb.Helper() | 	tb.Helper() | ||||||
|  |  | ||||||
| 	return testVaultServerCoreConfig(tb, &vault.CoreConfig{ | 	return testVaultServerCoreConfig(tb, &vault.CoreConfig{ | ||||||
| 		DisableMlock:       true, |  | ||||||
| 		DisableCache:       true, |  | ||||||
| 		Logger:             defaultVaultLogger, |  | ||||||
| 		CredentialBackends: defaultVaultCredentialBackends, | 		CredentialBackends: defaultVaultCredentialBackends, | ||||||
| 		AuditBackends:      defaultVaultAuditBackends, | 		AuditBackends:      defaultVaultAuditBackends, | ||||||
| 		LogicalBackends:    defaultVaultLogicalBackends, | 		LogicalBackends:    defaultVaultLogicalBackends, | ||||||
| @@ -251,8 +236,6 @@ func testVaultServerUninit(tb testing.TB) (*api.Client, func()) { | |||||||
|  |  | ||||||
| 	core, err := vault.NewCore(&vault.CoreConfig{ | 	core, err := vault.NewCore(&vault.CoreConfig{ | ||||||
| 		DisableMlock:       true, | 		DisableMlock:       true, | ||||||
| 		DisableCache:       true, |  | ||||||
| 		Logger:             defaultVaultLogger, |  | ||||||
| 		Physical:           inm, | 		Physical:           inm, | ||||||
| 		CredentialBackends: defaultVaultCredentialBackends, | 		CredentialBackends: defaultVaultCredentialBackends, | ||||||
| 		AuditBackends:      defaultVaultAuditBackends, | 		AuditBackends:      defaultVaultAuditBackends, | ||||||
|   | |||||||
| @@ -65,7 +65,6 @@ func TestProxy_ExitAfterAuth(t *testing.T) { | |||||||
| func testProxyExitAfterAuth(t *testing.T, viaFlag bool) { | func testProxyExitAfterAuth(t *testing.T, viaFlag bool) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"jwt": vaultjwt.Factory, | 			"jwt": vaultjwt.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -249,7 +248,6 @@ func TestProxy_AutoAuth_UserAgent(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	var h userAgentHandler | 	var h userAgentHandler | ||||||
| 	cluster := vault.NewTestCluster(t, &vault.CoreConfig{ | 	cluster := vault.NewTestCluster(t, &vault.CoreConfig{ | ||||||
| 		Logger: logger, |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"approle": credAppRole.Factory, | 			"approle": credAppRole.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -696,7 +694,6 @@ func TestProxy_ApiProxy_Retry(t *testing.T) { | |||||||
| 	var h handler | 	var h handler | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, | ||||||
| 		&vault.CoreConfig{ | 		&vault.CoreConfig{ | ||||||
| 			Logger: logger, |  | ||||||
| 			CredentialBackends: map[string]logical.Factory{ | 			CredentialBackends: map[string]logical.Factory{ | ||||||
| 				"approle": credAppRole.Factory, | 				"approle": credAppRole.Factory, | ||||||
| 			}, | 			}, | ||||||
| @@ -844,10 +841,7 @@ vault { | |||||||
| func TestProxy_Metrics(t *testing.T) { | func TestProxy_Metrics(t *testing.T) { | ||||||
| 	// Start a vault server | 	// Start a vault server | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	cluster := vault.NewTestCluster(t, | 	cluster := vault.NewTestCluster(t, nil, | ||||||
| 		&vault.CoreConfig{ |  | ||||||
| 			Logger: logger, |  | ||||||
| 		}, |  | ||||||
| 		&vault.TestClusterOptions{ | 		&vault.TestClusterOptions{ | ||||||
| 			HandlerFunc: vaulthttp.Handler, | 			HandlerFunc: vaulthttp.Handler, | ||||||
| 		}) | 		}) | ||||||
|   | |||||||
| @@ -3,13 +3,11 @@ package builtinplugins | |||||||
| import ( | import ( | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" | 	logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	logicalDb "github.com/hashicorp/vault/builtin/logical/database" | 	logicalDb "github.com/hashicorp/vault/builtin/logical/database" | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/consts" | 	"github.com/hashicorp/vault/sdk/helper/consts" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
| @@ -41,7 +39,6 @@ func TestBuiltinPluginsWork(t *testing.T) { | |||||||
| 				// builtinplugins.Registry, so we need to add it here to be able to test it! | 				// builtinplugins.Registry, so we need to add it here to be able to test it! | ||||||
| 				"database": logicalDb.Factory, | 				"database": logicalDb.Factory, | ||||||
| 			}, | 			}, | ||||||
| 			Logger:                      logging.NewVaultLogger(hclog.Trace), |  | ||||||
| 			PendingRemovalMountsAllowed: true, | 			PendingRemovalMountsAllowed: true, | ||||||
| 		}, | 		}, | ||||||
| 		&vault.TestClusterOptions{ | 		&vault.TestClusterOptions{ | ||||||
|   | |||||||
| @@ -7,13 +7,12 @@ import ( | |||||||
| 	"path" | 	"path" | ||||||
| 	"strconv" | 	"strconv" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	"github.com/hashicorp/vault/builtin/logical/transit" | 	"github.com/hashicorp/vault/builtin/logical/transit" | ||||||
|  | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers/teststorage" | 	"github.com/hashicorp/vault/helper/testhelpers/teststorage" | ||||||
| 	"github.com/hashicorp/vault/http" | 	"github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/internalshared/configutil" | 	"github.com/hashicorp/vault/internalshared/configutil" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| 	"github.com/hashicorp/vault/vault/seal" | 	"github.com/hashicorp/vault/vault/seal" | ||||||
| @@ -33,7 +32,7 @@ func NewTransitSealServer(t testing.T, idx int) *TransitSealServer { | |||||||
| 	opts := &vault.TestClusterOptions{ | 	opts := &vault.TestClusterOptions{ | ||||||
| 		NumCores:    1, | 		NumCores:    1, | ||||||
| 		HandlerFunc: http.Handler, | 		HandlerFunc: http.Handler, | ||||||
| 		Logger:      logging.NewVaultLogger(hclog.Trace).Named(t.Name()).Named("transit-seal" + strconv.Itoa(idx)), | 		Logger:      corehelpers.NewTestLogger(t).Named("transit-seal" + strconv.Itoa(idx)), | ||||||
| 	} | 	} | ||||||
| 	teststorage.InmemBackendSetup(conf, opts) | 	teststorage.InmemBackendSetup(conf, opts) | ||||||
| 	cluster := vault.NewTestCluster(t, conf, opts) | 	cluster := vault.NewTestCluster(t, conf, opts) | ||||||
|   | |||||||
| @@ -45,7 +45,6 @@ func getPluginClusterAndCore(t testing.TB, logger log.Logger) (*vault.TestCluste | |||||||
|  |  | ||||||
| 	cluster := vault.NewTestCluster(benchhelpers.TBtoT(t), coreConfig, &vault.TestClusterOptions{ | 	cluster := vault.NewTestCluster(benchhelpers.TBtoT(t), coreConfig, &vault.TestClusterOptions{ | ||||||
| 		HandlerFunc: Handler, | 		HandlerFunc: Handler, | ||||||
| 		Logger:      logger.Named("testclusteroptions"), |  | ||||||
| 	}) | 	}) | ||||||
| 	cluster.Start() | 	cluster.Start() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,9 +10,8 @@ import ( | |||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/builtin/logical/transit" | 	"github.com/hashicorp/vault/builtin/logical/transit" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| 	"github.com/hashicorp/vault/vault/seal" | 	"github.com/hashicorp/vault/vault/seal" | ||||||
| @@ -169,7 +168,7 @@ func TestSysInit_Put_ValidateParams_AutoUnseal(t *testing.T) { | |||||||
| 	opts := &vault.TestClusterOptions{ | 	opts := &vault.TestClusterOptions{ | ||||||
| 		NumCores:    1, | 		NumCores:    1, | ||||||
| 		HandlerFunc: Handler, | 		HandlerFunc: Handler, | ||||||
| 		Logger:      logging.NewVaultLogger(hclog.Trace).Named(t.Name()).Named("transit-seal" + strconv.Itoa(0)), | 		Logger:      corehelpers.NewTestLogger(t).Named("transit-seal" + strconv.Itoa(0)), | ||||||
| 	} | 	} | ||||||
| 	cluster := vault.NewTestCluster(t, conf, opts) | 	cluster := vault.NewTestCluster(t, conf, opts) | ||||||
| 	cluster.Start() | 	cluster.Start() | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	ldapcred "github.com/hashicorp/vault/builtin/credential/ldap" | 	ldapcred "github.com/hashicorp/vault/builtin/credential/ldap" | ||||||
| 	"github.com/hashicorp/vault/helper/namespace" | 	"github.com/hashicorp/vault/helper/namespace" | ||||||
| 	"github.com/hashicorp/vault/sdk/framework" | 	"github.com/hashicorp/vault/sdk/framework" | ||||||
| @@ -38,11 +37,7 @@ rule "charset" { | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestIdentity_BackendTemplating(t *testing.T) { | func TestIdentity_BackendTemplating(t *testing.T) { | ||||||
| 	var err error |  | ||||||
| 	coreConfig := &CoreConfig{ | 	coreConfig := &CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"ldap": ldapcred.Factory, | 			"ldap": ldapcred.Factory, | ||||||
| 		}, | 		}, | ||||||
| @@ -178,11 +173,7 @@ func TestIdentity_BackendTemplating(t *testing.T) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestDynamicSystemView_GeneratePasswordFromPolicy_successful(t *testing.T) { | func TestDynamicSystemView_GeneratePasswordFromPolicy_successful(t *testing.T) { | ||||||
| 	var err error |  | ||||||
| 	coreConfig := &CoreConfig{ | 	coreConfig := &CoreConfig{ | ||||||
| 		DisableMlock:       true, |  | ||||||
| 		DisableCache:       true, |  | ||||||
| 		Logger:             log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{}, | 		CredentialBackends: map[string]logical.Factory{}, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -201,7 +192,7 @@ func TestDynamicSystemView_GeneratePasswordFromPolicy_successful(t *testing.T) { | |||||||
| 	req.ClientToken = cluster.RootToken | 	req.ClientToken = cluster.RootToken | ||||||
| 	req.Data["policy"] = b64Policy | 	req.Data["policy"] = b64Policy | ||||||
|  |  | ||||||
| 	_, err = core.HandleRequest(namespace.RootContext(nil), req) | 	_, err := core.HandleRequest(namespace.RootContext(nil), req) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Fatalf("err: %v", err) | 		t.Fatalf("err: %v", err) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ import ( | |||||||
| 	"strings" | 	"strings" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/helper/namespace" | 	"github.com/hashicorp/vault/helper/namespace" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers/pluginhelpers" | 	"github.com/hashicorp/vault/helper/testhelpers/pluginhelpers" | ||||||
| @@ -67,9 +66,6 @@ func TestCore_EnableExternalPlugin(t *testing.T) { | |||||||
| 	} { | 	} { | ||||||
| 		t.Run(name, func(t *testing.T) { | 		t.Run(name, func(t *testing.T) { | ||||||
| 			coreConfig := &CoreConfig{ | 			coreConfig := &CoreConfig{ | ||||||
| 				DisableMlock:       true, |  | ||||||
| 				DisableCache:       true, |  | ||||||
| 				Logger:             log.NewNullLogger(), |  | ||||||
| 				CredentialBackends: map[string]logical.Factory{}, | 				CredentialBackends: map[string]logical.Factory{}, | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ import ( | |||||||
| 	"encoding/base64" | 	"encoding/base64" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	"github.com/hashicorp/vault/audit" | 	"github.com/hashicorp/vault/audit" | ||||||
| 	auditFile "github.com/hashicorp/vault/builtin/audit/file" | 	auditFile "github.com/hashicorp/vault/builtin/audit/file" | ||||||
| @@ -37,9 +36,6 @@ func testVaultServerUnseal(t testing.TB) (*api.Client, []string, func()) { | |||||||
| 	t.Helper() | 	t.Helper() | ||||||
|  |  | ||||||
| 	return testVaultServerCoreConfig(t, &vault.CoreConfig{ | 	return testVaultServerCoreConfig(t, &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       log.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"userpass": credUserpass.Factory, | 			"userpass": credUserpass.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -8,7 +8,6 @@ import ( | |||||||
| 	"strings" | 	"strings" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	log "github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	"github.com/hashicorp/vault/helper/builtinplugins" | 	"github.com/hashicorp/vault/helper/builtinplugins" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | ||||||
| @@ -22,11 +21,8 @@ func TestSudoPaths(t *testing.T) { | |||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
|  |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock:        true, |  | ||||||
| 		DisableCache:        true, |  | ||||||
| 		EnableRaw:           true, | 		EnableRaw:           true, | ||||||
| 		EnableIntrospection: true, | 		EnableIntrospection: true, | ||||||
| 		Logger:              log.NewNullLogger(), |  | ||||||
| 		BuiltinRegistry:     builtinplugins.Registry, | 		BuiltinRegistry:     builtinplugins.Registry, | ||||||
| 	} | 	} | ||||||
| 	client, _, closer := testVaultServerCoreConfig(t, coreConfig) | 	client, _, closer := testVaultServerCoreConfig(t, coreConfig) | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ package misc | |||||||
| import ( | import ( | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| @@ -16,13 +15,11 @@ import ( | |||||||
| // Tests the regression in | // Tests the regression in | ||||||
| // https://github.com/hashicorp/vault/pull/6920 | // https://github.com/hashicorp/vault/pull/6920 | ||||||
| func TestRecoverFromPanic(t *testing.T) { | func TestRecoverFromPanic(t *testing.T) { | ||||||
| 	logger := hclog.New(nil) |  | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		LogicalBackends: map[string]logical.Factory{ | 		LogicalBackends: map[string]logical.Factory{ | ||||||
| 			"noop": vault.NoopBackendFactory, | 			"noop": vault.NoopBackendFactory, | ||||||
| 		}, | 		}, | ||||||
| 		EnableRaw: true, | 		EnableRaw: true, | ||||||
| 		Logger:    logger, |  | ||||||
| 	} | 	} | ||||||
| 	cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ | 	cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ | ||||||
| 		HandlerFunc: vaulthttp.Handler, | 		HandlerFunc: vaulthttp.Handler, | ||||||
|   | |||||||
| @@ -8,18 +8,16 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	"github.com/go-test/deep" | 	"github.com/go-test/deep" | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers" | 	"github.com/hashicorp/vault/helper/testhelpers" | ||||||
|  | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/http" | 	"github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/sdk/physical/inmem" | 	"github.com/hashicorp/vault/sdk/physical/inmem" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| 	"go.uber.org/atomic" | 	"go.uber.org/atomic" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestRecovery(t *testing.T) { | func TestRecovery(t *testing.T) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Debug).Named(t.Name()) | 	inm, err := inmem.NewTransactionalInmemHA(nil, corehelpers.NewTestLogger(t)) | ||||||
| 	inm, err := inmem.NewTransactionalInmemHA(nil, logger) |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Fatal(err) | 		t.Fatal(err) | ||||||
| 	} | 	} | ||||||
| @@ -30,7 +28,6 @@ func TestRecovery(t *testing.T) { | |||||||
| 	{ | 	{ | ||||||
| 		conf := vault.CoreConfig{ | 		conf := vault.CoreConfig{ | ||||||
| 			Physical: inm, | 			Physical: inm, | ||||||
| 			Logger:   logger, |  | ||||||
| 		} | 		} | ||||||
| 		opts := vault.TestClusterOptions{ | 		opts := vault.TestClusterOptions{ | ||||||
| 			HandlerFunc: http.Handler, | 			HandlerFunc: http.Handler, | ||||||
| @@ -73,7 +70,6 @@ func TestRecovery(t *testing.T) { | |||||||
| 		var tokenRef atomic.String | 		var tokenRef atomic.String | ||||||
| 		conf := vault.CoreConfig{ | 		conf := vault.CoreConfig{ | ||||||
| 			Physical:     inm, | 			Physical:     inm, | ||||||
| 			Logger:       logger, |  | ||||||
| 			RecoveryMode: true, | 			RecoveryMode: true, | ||||||
| 		} | 		} | ||||||
| 		opts := vault.TestClusterOptions{ | 		opts := vault.TestClusterOptions{ | ||||||
| @@ -117,7 +113,6 @@ func TestRecovery(t *testing.T) { | |||||||
| 		// Now go back to regular mode and verify that our changes are present | 		// Now go back to regular mode and verify that our changes are present | ||||||
| 		conf := vault.CoreConfig{ | 		conf := vault.CoreConfig{ | ||||||
| 			Physical: inm, | 			Physical: inm, | ||||||
| 			Logger:   logger, |  | ||||||
| 		} | 		} | ||||||
| 		opts := vault.TestClusterOptions{ | 		opts := vault.TestClusterOptions{ | ||||||
| 			HandlerFunc: http.Handler, | 			HandlerFunc: http.Handler, | ||||||
|   | |||||||
| @@ -7,15 +7,13 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers/minimal" |  | ||||||
|  |  | ||||||
| 	"github.com/go-test/deep" | 	"github.com/go-test/deep" | ||||||
| 	"github.com/hashicorp/go-hclog" |  | ||||||
| 	"github.com/hashicorp/go-secure-stdlib/strutil" | 	"github.com/hashicorp/go-secure-stdlib/strutil" | ||||||
| 	"github.com/hashicorp/vault/api" | 	"github.com/hashicorp/vault/api" | ||||||
| 	"github.com/hashicorp/vault/builtin/credential/ldap" | 	"github.com/hashicorp/vault/builtin/credential/ldap" | ||||||
| 	credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" | 	credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" | ||||||
| 	ldaphelper "github.com/hashicorp/vault/helper/testhelpers/ldap" | 	ldaphelper "github.com/hashicorp/vault/helper/testhelpers/ldap" | ||||||
|  | 	"github.com/hashicorp/vault/helper/testhelpers/minimal" | ||||||
| 	vaulthttp "github.com/hashicorp/vault/http" | 	vaulthttp "github.com/hashicorp/vault/http" | ||||||
| 	"github.com/hashicorp/vault/sdk/logical" | 	"github.com/hashicorp/vault/sdk/logical" | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| @@ -24,9 +22,6 @@ import ( | |||||||
| func TestPolicy_NoDefaultPolicy(t *testing.T) { | func TestPolicy_NoDefaultPolicy(t *testing.T) { | ||||||
| 	var err error | 	var err error | ||||||
| 	coreConfig := &vault.CoreConfig{ | 	coreConfig := &vault.CoreConfig{ | ||||||
| 		DisableMlock: true, |  | ||||||
| 		DisableCache: true, |  | ||||||
| 		Logger:       hclog.NewNullLogger(), |  | ||||||
| 		CredentialBackends: map[string]logical.Factory{ | 		CredentialBackends: map[string]logical.Factory{ | ||||||
| 			"ldap": ldap.Factory, | 			"ldap": ldap.Factory, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -9,15 +9,15 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/hashicorp/go-hclog" | 	"github.com/hashicorp/go-hclog" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers" | 	"github.com/hashicorp/vault/helper/testhelpers" | ||||||
|  | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/helper/testhelpers/teststorage" | 	"github.com/hashicorp/vault/helper/testhelpers/teststorage" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/logging" |  | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type testFunc func(t *testing.T, logger hclog.Logger, storage teststorage.ReusableStorage, basePort int) | type testFunc func(t *testing.T, logger hclog.Logger, storage teststorage.ReusableStorage, basePort int) | ||||||
|  |  | ||||||
| func testVariousBackends(t *testing.T, tf testFunc, basePort int, includeRaft bool) { | func testVariousBackends(t *testing.T, tf testFunc, basePort int, includeRaft bool) { | ||||||
| 	logger := logging.NewVaultLogger(hclog.Trace).Named(t.Name()) | 	logger := corehelpers.NewTestLogger(t) | ||||||
|  |  | ||||||
| 	t.Run("inmem", func(t *testing.T) { | 	t.Run("inmem", func(t *testing.T) { | ||||||
| 		t.Parallel() | 		t.Parallel() | ||||||
|   | |||||||
| @@ -8,20 +8,18 @@ package vault | |||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
| 	"context" | 	"context" | ||||||
| 	"sync" |  | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	proto "github.com/golang/protobuf/proto" | 	proto "github.com/golang/protobuf/proto" | ||||||
| 	log "github.com/hashicorp/go-hclog" | 	log "github.com/hashicorp/go-hclog" | ||||||
| 	wrapping "github.com/hashicorp/go-kms-wrapping/v2" | 	wrapping "github.com/hashicorp/go-kms-wrapping/v2" | ||||||
|  | 	"github.com/hashicorp/vault/helper/testhelpers/corehelpers" | ||||||
| 	"github.com/hashicorp/vault/sdk/physical" | 	"github.com/hashicorp/vault/sdk/physical" | ||||||
| 	"github.com/hashicorp/vault/sdk/physical/inmem" | 	"github.com/hashicorp/vault/sdk/physical/inmem" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestSealUnwrapper(t *testing.T) { | func TestSealUnwrapper(t *testing.T) { | ||||||
| 	logger := log.New(&log.LoggerOptions{ | 	logger := corehelpers.NewTestLogger(t) | ||||||
| 		Mutex: &sync.Mutex{}, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	// Test without transactions | 	// Test without transactions | ||||||
| 	phys, err := inmem.NewInmemHA(nil, logger) | 	phys, err := inmem.NewInmemHA(nil, logger) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nick Cabatoff
					Nick Cabatoff