diff --git a/command/auth_disable_test.go b/command/auth_disable_test.go index dbe2e776f9..51419b8663 100644 --- a/command/auth_disable_test.go +++ b/command/auth_disable_test.go @@ -50,7 +50,11 @@ func TestAuthDisableCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testAuthDisableCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/auth_help_test.go b/command/auth_help_test.go index 9457bea0ec..0c0d36f168 100644 --- a/command/auth_help_test.go +++ b/command/auth_help_test.go @@ -54,7 +54,11 @@ func TestAuthHelpCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testAuthHelpCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/auth_tune_test.go b/command/auth_tune_test.go index 28e35dcd11..e358f59ee3 100644 --- a/command/auth_tune_test.go +++ b/command/auth_tune_test.go @@ -51,7 +51,11 @@ func TestAuthTuneCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testAuthTuneCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/delete_test.go b/command/delete_test.go index 44970f57af..2d642b1fc9 100644 --- a/command/delete_test.go +++ b/command/delete_test.go @@ -50,7 +50,11 @@ func TestDeleteCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testDeleteCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/operator_generate_root_test.go b/command/operator_generate_root_test.go index 5050218a38..27a2b13a01 100644 --- a/command/operator_generate_root_test.go +++ b/command/operator_generate_root_test.go @@ -91,7 +91,11 @@ func TestOperatorGenerateRootCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorGenerateRootCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { @@ -109,7 +113,11 @@ func TestOperatorGenerateRootCommand_Run(t *testing.T) { t.Run("generate_otp", func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorGenerateRootCommand(t) + cmd.client = client code := cmd.Run([]string{ "-generate-otp", @@ -130,7 +138,11 @@ func TestOperatorGenerateRootCommand_Run(t *testing.T) { encoded := "L9MaZ/4mQanpOV6QeWd84g==" otp := "dIeeezkjpDUv3fy7MYPOLQ==" + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorGenerateRootCommand(t) + cmd.client = client // Simulate piped output to print raw output old := os.Stdout diff --git a/command/operator_key_status_test.go b/command/operator_key_status_test.go index 5c1aada3e6..01cb913628 100644 --- a/command/operator_key_status_test.go +++ b/command/operator_key_status_test.go @@ -44,7 +44,11 @@ func TestOperatorKeyStatusCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorKeyStatusCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/operator_unseal_test.go b/command/operator_unseal_test.go index aa6afe6943..7078b17cfc 100644 --- a/command/operator_unseal_test.go +++ b/command/operator_unseal_test.go @@ -27,7 +27,11 @@ func TestOperatorUnsealCommand_Run(t *testing.T) { t.Run("error_non_terminal", func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorUnsealCommand(t) + cmd.client = client cmd.testOutput = ioutil.Discard code := cmd.Run(nil) diff --git a/command/policy_delete_test.go b/command/policy_delete_test.go index 1c30c739d7..2c822de9d4 100644 --- a/command/policy_delete_test.go +++ b/command/policy_delete_test.go @@ -51,7 +51,11 @@ func TestPolicyDeleteCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testPolicyDeleteCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/policy_fmt_test.go b/command/policy_fmt_test.go index 93e8daa1bf..53a99e15a7 100644 --- a/command/policy_fmt_test.go +++ b/command/policy_fmt_test.go @@ -52,7 +52,11 @@ func TestPolicyFmtCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testPolicyFmtCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { @@ -87,7 +91,11 @@ path "secret" { } f.Close() + client, closer := testVaultServer(t) + defer closer() + _, cmd := testPolicyFmtCommand(t) + cmd.client = client code := cmd.Run([]string{ f.Name(), @@ -126,7 +134,11 @@ path "secret" { } f.Close() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testPolicyFmtCommand(t) + cmd.client = client code := cmd.Run([]string{ f.Name(), @@ -157,7 +169,11 @@ path "secret" { } f.Close() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testPolicyFmtCommand(t) + cmd.client = client code := cmd.Run([]string{ f.Name(), @@ -188,7 +204,11 @@ path "secret" { } f.Close() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testPolicyFmtCommand(t) + cmd.client = client code := cmd.Run([]string{ f.Name(), diff --git a/command/rotate_test.go b/command/rotate_test.go index 8f9756de06..37ac323405 100644 --- a/command/rotate_test.go +++ b/command/rotate_test.go @@ -44,7 +44,11 @@ func TestOperatorRotateCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testOperatorRotateCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/secrets_move_test.go b/command/secrets_move_test.go index 0936a7dd30..1af52d131d 100644 --- a/command/secrets_move_test.go +++ b/command/secrets_move_test.go @@ -56,7 +56,11 @@ func TestSecretsMoveCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testSecretsMoveCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/secrets_tune_test.go b/command/secrets_tune_test.go index 535132b76c..88ed2ae06e 100644 --- a/command/secrets_tune_test.go +++ b/command/secrets_tune_test.go @@ -51,7 +51,11 @@ func TestSecretsTuneCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testSecretsTuneCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/token_capabilities_test.go b/command/token_capabilities_test.go index 74efd0cab5..d529d33eec 100644 --- a/command/token_capabilities_test.go +++ b/command/token_capabilities_test.go @@ -42,7 +42,11 @@ func TestTokenCapabilitiesCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testTokenCapabilitiesCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/token_revoke_test.go b/command/token_revoke_test.go index 60a1345c4b..7f66e9d4a0 100644 --- a/command/token_revoke_test.go +++ b/command/token_revoke_test.go @@ -86,7 +86,11 @@ func TestTokenRevokeCommand_Run(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testTokenRevokeCommand(t) + cmd.client = client code := cmd.Run(tc.args) if code != tc.code { diff --git a/command/version_test.go b/command/version_test.go index 2f132fed79..0f59e9ffcb 100644 --- a/command/version_test.go +++ b/command/version_test.go @@ -26,7 +26,12 @@ func TestVersionCommand_Run(t *testing.T) { t.Run("output", func(t *testing.T) { t.Parallel() + client, closer := testVaultServer(t) + defer closer() + ui, cmd := testVersionCommand(t) + cmd.client = client + code := cmd.Run(nil) if exp := 0; code != exp { t.Errorf("expected %d to be %d", code, exp)