Make consul backend tests opt-in

This way we don't require contributers to have consul installed to run
make test.
This commit is contained in:
James Bardin 2017-03-14 14:41:16 -04:00
parent 7233cc9cae
commit 86f711f6fc
2 changed files with 8 additions and 1 deletions

View File

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

View File

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