Always use a local test server (#4207)

Some commands didn't setup a local test server since they didn't need
it. Other commands didn't setup a local test server because Seth forgot.

Long story short, I kept seeing weird requests to my Vault server when I
ran tests, and that should never happen. This ensures all test requests
will go to a test Vault instance.

Benchmarks show this adds 0.4s to the command test suite.
This commit is contained in:
Seth Vargo
2018-03-28 22:34:37 +08:00
committed by Jeff Mitchell
parent 5b4abc09dd
commit e3de6c463c
15 changed files with 85 additions and 0 deletions

View File

@@ -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 {