diff --git a/state/state_test.go b/state/state_test.go new file mode 100644 index 000000000..27cfa4103 --- /dev/null +++ b/state/state_test.go @@ -0,0 +1,23 @@ +package state + +import ( + "flag" + "io/ioutil" + "log" + "os" + "testing" + + "github.com/hashicorp/terraform/helper/logging" +) + +func TestMain(m *testing.M) { + flag.Parse() + if testing.Verbose() { + // if we're verbose, use the logging requested by TF_LOG + logging.SetOutput() + } else { + // otherwise silence all logs + log.SetOutput(ioutil.Discard) + } + os.Exit(m.Run()) +}