mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
VAULT-24452: audit refactor (#26460)
* Refactor audit code into audit package * remove builtin/audit * removed unrequired files
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -169,26 +168,12 @@ func TestAuditEnableCommand_Run(t *testing.T) {
|
||||
client, closer := testVaultServerAllBackends(t)
|
||||
defer closer()
|
||||
|
||||
files, err := ioutil.ReadDir("../builtin/audit")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var backends []string
|
||||
for _, f := range files {
|
||||
if f.IsDir() {
|
||||
backends = append(backends, f.Name())
|
||||
}
|
||||
}
|
||||
|
||||
for _, b := range backends {
|
||||
for name := range auditBackends {
|
||||
ui, cmd := testAuditEnableCommand(t)
|
||||
cmd.client = client
|
||||
|
||||
args := []string{
|
||||
b,
|
||||
}
|
||||
switch b {
|
||||
args := []string{name}
|
||||
switch name {
|
||||
case "file":
|
||||
args = append(args, "file_path=discard")
|
||||
case "socket":
|
||||
@@ -199,15 +184,10 @@ func TestAuditEnableCommand_Run(t *testing.T) {
|
||||
t.Log("skipping syslog test on WSL")
|
||||
continue
|
||||
}
|
||||
if os.Getenv("CIRCLECI") == "true" {
|
||||
// TODO install syslog in docker image we run our tests in
|
||||
t.Log("skipping syslog test on CircleCI")
|
||||
continue
|
||||
}
|
||||
}
|
||||
code := cmd.Run(args)
|
||||
if exp := 0; code != exp {
|
||||
t.Errorf("type %s, expected %d to be %d - %s", b, code, exp, ui.OutputWriter.String()+ui.ErrorWriter.String())
|
||||
t.Errorf("type %s, expected %d to be %d - %s", name, code, exp, ui.OutputWriter.String()+ui.ErrorWriter.String())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user