Vault test cluster helper refactorings, mostly audit related (#18928)

* Move some test helper stuff from the vault package to a new helper/testhelpers/corehelpers package.  Consolidate on a single "noop audit" implementation.
This commit is contained in:
Nick Cabatoff
2023-02-01 08:33:16 -05:00
committed by GitHub
parent 6a9ca261d1
commit 970ed07b04
26 changed files with 562 additions and 612 deletions

View File

@@ -12,8 +12,10 @@ import (
"testing"
"github.com/go-test/deep"
"github.com/hashicorp/vault/audit"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/helper/pgpkeys"
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
"github.com/hashicorp/vault/sdk/helper/xor"
"github.com/hashicorp/vault/sdk/logical"
"github.com/hashicorp/vault/vault"
@@ -224,9 +226,11 @@ func enableNoopAudit(t *testing.T, token string, core *vault.Core) {
func testCoreUnsealedWithAudit(t *testing.T, records **[][]byte) (*vault.Core, [][]byte, string) {
conf := &vault.CoreConfig{
BuiltinRegistry: vault.NewMockBuiltinRegistry(),
BuiltinRegistry: corehelpers.NewMockBuiltinRegistry(),
AuditBackends: map[string]audit.Factory{
"noop": corehelpers.NoopAuditFactory(records),
},
}
vault.AddNoopAudit(conf, records)
core, keys, token := vault.TestCoreUnsealedWithConfig(t, conf)
return core, keys, token
}