From 39f2da0fbe70e2aa39fd9ad2010b38bfc02c8b72 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 29 Mar 2015 16:20:34 -0700 Subject: [PATCH] command: unit tests pass --- builtin/logical/consul/backend_test.go | 4 ++++ command/mounts_test.go | 3 ++- command/read_test.go | 3 ++- command/write_test.go | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/builtin/logical/consul/backend_test.go b/builtin/logical/consul/backend_test.go index f45f762d92..4704de9dd6 100644 --- a/builtin/logical/consul/backend_test.go +++ b/builtin/logical/consul/backend_test.go @@ -32,6 +32,10 @@ func TestBackend_basic(t *testing.T) { } func testStartConsulServer(t *testing.T) (map[string]interface{}, *os.Process) { + if _, err := exec.LookPath("consul"); err != nil { + t.Skipf("consul not found: %s", err) + } + td, err := ioutil.TempDir("", "vault") if err != nil { t.Fatalf("err: %s", err) diff --git a/command/mounts_test.go b/command/mounts_test.go index 5cc60c82ed..3602e71fd7 100644 --- a/command/mounts_test.go +++ b/command/mounts_test.go @@ -9,9 +9,10 @@ import ( ) func TestMounts(t *testing.T) { - core, _ := vault.TestCoreUnsealed(t) + core, _, token := vault.TestCoreUnsealed(t) ln, addr := http.TestServer(t, core) defer ln.Close() + http.TestServerAuth(t, addr, token) ui := new(cli.MockUi) c := &MountsCommand{ diff --git a/command/read_test.go b/command/read_test.go index f1f3d22ce3..5a5c0ab55a 100644 --- a/command/read_test.go +++ b/command/read_test.go @@ -9,9 +9,10 @@ import ( ) func TestRead(t *testing.T) { - core, _ := vault.TestCoreUnsealed(t) + core, _, token := vault.TestCoreUnsealed(t) ln, addr := http.TestServer(t, core) defer ln.Close() + http.TestServerAuth(t, addr, token) ui := new(cli.MockUi) c := &ReadCommand{ diff --git a/command/write_test.go b/command/write_test.go index a328dc72a7..461c741a48 100644 --- a/command/write_test.go +++ b/command/write_test.go @@ -10,9 +10,10 @@ import ( ) func TestWrite(t *testing.T) { - core, _ := vault.TestCoreUnsealed(t) + core, _, token := vault.TestCoreUnsealed(t) ln, addr := http.TestServer(t, core) defer ln.Close() + http.TestServerAuth(t, addr, token) ui := new(cli.MockUi) c := &WriteCommand{ @@ -46,9 +47,10 @@ func TestWrite(t *testing.T) { } func TestWrite_arbitrary(t *testing.T) { - core, _ := vault.TestCoreUnsealed(t) + core, _, token := vault.TestCoreUnsealed(t) ln, addr := http.TestServer(t, core) defer ln.Close() + http.TestServerAuth(t, addr, token) stdinR, stdinW := io.Pipe() ui := new(cli.MockUi)