quiet the consul server during backend tests
Don't display logs unless using `-v`
This commit is contained in:
parent
9529bd3bf0
commit
fa7743b627
|
@ -2,6 +2,7 @@ package consul
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -13,8 +14,21 @@ func TestBackend_impl(t *testing.T) {
|
||||||
var _ backend.Backend = new(Backend)
|
var _ backend.Backend = new(Backend)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newConsulTestServer(t *testing.T) *testutil.TestServer {
|
||||||
|
srv := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
|
||||||
|
c.LogLevel = "warn"
|
||||||
|
|
||||||
|
if !testing.Verbose() {
|
||||||
|
c.Stdout = ioutil.Discard
|
||||||
|
c.Stderr = ioutil.Discard
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return srv
|
||||||
|
}
|
||||||
|
|
||||||
func TestBackend(t *testing.T) {
|
func TestBackend(t *testing.T) {
|
||||||
srv := testutil.NewTestServer(t)
|
srv := newConsulTestServer(t)
|
||||||
defer srv.Stop()
|
defer srv.Stop()
|
||||||
|
|
||||||
// Get the backend
|
// Get the backend
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/testutil"
|
|
||||||
"github.com/hashicorp/terraform/backend"
|
"github.com/hashicorp/terraform/backend"
|
||||||
"github.com/hashicorp/terraform/state/remote"
|
"github.com/hashicorp/terraform/state/remote"
|
||||||
)
|
)
|
||||||
|
@ -16,7 +15,7 @@ func TestRemoteClient_impl(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRemoteClient(t *testing.T) {
|
func TestRemoteClient(t *testing.T) {
|
||||||
srv := testutil.NewTestServer(t)
|
srv := newConsulTestServer(t)
|
||||||
defer srv.Stop()
|
defer srv.Stop()
|
||||||
|
|
||||||
// Get the backend
|
// Get the backend
|
||||||
|
@ -36,7 +35,7 @@ func TestRemoteClient(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_stateLock(t *testing.T) {
|
func TestConsul_stateLock(t *testing.T) {
|
||||||
srv := testutil.NewTestServer(t)
|
srv := newConsulTestServer(t)
|
||||||
defer srv.Stop()
|
defer srv.Stop()
|
||||||
|
|
||||||
path := fmt.Sprintf("tf-unit/%s", time.Now().String())
|
path := fmt.Sprintf("tf-unit/%s", time.Now().String())
|
||||||
|
|
Loading…
Reference in New Issue