Delay salt initialization for audit backends

This commit is contained in:
Jeff Mitchell
2017-05-23 20:36:20 -04:00
parent 41d4c69b54
commit dd26071875
18 changed files with 382 additions and 105 deletions

View File

@@ -9,11 +9,10 @@ import (
"github.com/hashicorp/vault/audit"
"github.com/hashicorp/vault/helper/salt"
"github.com/hashicorp/vault/logical"
)
func TestAuditFile_fileModeNew(t *testing.T) {
salter, _ := salt.NewSalt(nil, nil)
modeStr := "0777"
mode, err := strconv.ParseUint(modeStr, 8, 32)
@@ -28,8 +27,9 @@ func TestAuditFile_fileModeNew(t *testing.T) {
}
_, err = Factory(&audit.BackendConfig{
Salt: salter,
Config: config,
SaltConfig: &salt.Config{},
SaltView: &logical.InmemStorage{},
Config: config,
})
if err != nil {
t.Fatal(err)
@@ -45,8 +45,6 @@ func TestAuditFile_fileModeNew(t *testing.T) {
}
func TestAuditFile_fileModeExisting(t *testing.T) {
salter, _ := salt.NewSalt(nil, nil)
f, err := ioutil.TempFile("", "test")
if err != nil {
t.Fatalf("Failure to create test file.")
@@ -68,8 +66,9 @@ func TestAuditFile_fileModeExisting(t *testing.T) {
}
_, err = Factory(&audit.BackendConfig{
Salt: salter,
Config: config,
Config: config,
SaltConfig: &salt.Config{},
SaltView: &logical.InmemStorage{},
})
if err != nil {
t.Fatal(err)