From 86f711f6fc26659a47182d61806763d75aa39022 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 14 Mar 2017 14:41:16 -0400 Subject: [PATCH] Make consul backend tests opt-in This way we don't require contributers to have consul installed to run make test. --- .travis.yml | 2 +- backend/remote-state/consul/backend_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c8bcec473..9a88a87a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ go: - 1.8 env: - - CONSUL_VERSION=0.7.5 + - CONSUL_VERSION=0.7.5 TF_CONSUL_TEST=1 # Fetch consul for the backend and provider tests before_install: diff --git a/backend/remote-state/consul/backend_test.go b/backend/remote-state/consul/backend_test.go index 819e790d7..6a8566e0c 100644 --- a/backend/remote-state/consul/backend_test.go +++ b/backend/remote-state/consul/backend_test.go @@ -3,6 +3,7 @@ package consul import ( "fmt" "io/ioutil" + "os" "testing" "time" @@ -15,6 +16,12 @@ func TestBackend_impl(t *testing.T) { } func newConsulTestServer(t *testing.T) *testutil.TestServer { + skip := os.Getenv("TF_ACC") == "" && os.Getenv("TF_CONSUL_TEST") == "" + if skip { + t.Log("consul server tests require setting TF_ACC or TF_CONSUL_TEST") + t.Skip() + } + srv := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) { c.LogLevel = "warn"