zoekt-archive-index: disable log in tests unless verbose
Was running this test a lot and the log output was spammy.
Change-Id: I8cb4fe7ad9372abbb1cf9f46edddeadb2584b55b
diff --git a/cmd/zoekt-archive-index/e2e_test.go b/cmd/zoekt-archive-index/e2e_test.go
index 6456f41..c4e16a2 100644
--- a/cmd/zoekt-archive-index/e2e_test.go
+++ b/cmd/zoekt-archive-index/e2e_test.go
@@ -6,9 +6,11 @@
"compress/gzip"
"context"
"errors"
+ "flag"
"fmt"
"io"
"io/ioutil"
+ "log"
"os"
"strings"
"testing"
@@ -19,6 +21,14 @@
"github.com/google/zoekt/shards"
)
+func TestMain(m *testing.M) {
+ flag.Parse()
+ if !testing.Verbose() {
+ log.SetOutput(ioutil.Discard)
+ }
+ os.Exit(m.Run())
+}
+
func writeArchive(w io.Writer, format string, files map[string]string) (err error) {
if format == "zip" {
zw := zip.NewWriter(w)