metropolis/*: confine etcd output in tests

The etcd test cluster logic produces some very chatty logs that end up
in stdout.

This confines the etcd logs themselves, as well as gRPC logs that the
test logic also always enables by default.

Change-Id: I1070f14b20e870865b510ae24015402c0469ceff
Reviewed-on: https://review.monogon.dev/c/monogon/+/1487
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/pkg/pki/certificate_test.go b/metropolis/pkg/pki/certificate_test.go
index d38b559..19baf94 100644
--- a/metropolis/pkg/pki/certificate_test.go
+++ b/metropolis/pkg/pki/certificate_test.go
@@ -10,15 +10,24 @@
 
 	"go.etcd.io/etcd/client/pkg/v3/testutil"
 	"go.etcd.io/etcd/tests/v3/integration"
+	"go.uber.org/zap"
+
+	"source.monogon.dev/metropolis/pkg/logtree"
 )
 
 // TestManaged ensures Managed Certificates work, including re-ensuring
 // certificates with the same data and issuing subordinate certificates.
 func TestManaged(t *testing.T) {
+	lt := logtree.New()
+	logtree.PipeAllToTest(t, lt)
 	tb, cancel := testutil.NewTestingTBProthesis("pki-managed")
 	defer cancel()
 	cluster := integration.NewClusterV3(tb, &integration.ClusterConfig{
 		Size: 1,
+		LoggerBuilder: func(memberName string) *zap.Logger {
+			dn := logtree.DN("etcd." + memberName)
+			return logtree.Zapify(lt.MustLeveledFor(dn), zap.WarnLevel)
+		},
 	})
 	cl := cluster.Client(0)
 	defer cluster.Terminate(tb)
@@ -103,10 +112,16 @@
 // re-Ensuring certificates with the same public key, and attempting to re-issue
 // the same certificate with a different public key (which should fail).
 func TestExternal(t *testing.T) {
+	lt := logtree.New()
+	logtree.PipeAllToTest(t, lt)
 	tb, cancel := testutil.NewTestingTBProthesis("pki-managed")
 	defer cancel()
 	cluster := integration.NewClusterV3(tb, &integration.ClusterConfig{
 		Size: 1,
+		LoggerBuilder: func(memberName string) *zap.Logger {
+			dn := logtree.DN("etcd." + memberName)
+			return logtree.Zapify(lt.MustLeveledFor(dn), zap.WarnLevel)
+		},
 	})
 	cl := cluster.Client(0)
 	defer cluster.Terminate(tb)