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/third_party/go/patches/etcd-integration-logging.patch b/third_party/go/patches/etcd-integration-logging.patch
new file mode 100644
index 0000000..9652524
--- /dev/null
+++ b/third_party/go/patches/etcd-integration-logging.patch
@@ -0,0 +1,44 @@
+Implement LoggerBuilder override in etcd integration library. That library is
+generally not designed to be consumed by outside code, and we should migrate
+off of it instead. But that's a future Monogon problem.
+
+diff -ur io_etcd_go_etcd_tests_v3.orig/integration/cluster.go io_etcd_go_etcd_tests_v3/integration/cluster.go
+--- io_etcd_go_etcd_tests_v3.orig/integration/cluster.go 2023-04-05 10:18:09.220532258 +0200
++++ io_etcd_go_etcd_tests_v3/integration/cluster.go 2023-04-05 10:26:36.870901710 +0200
+@@ -171,6 +170,7 @@
+
+ WatchProgressNotifyInterval time.Duration
+ CorruptCheckTime time.Duration
++ LoggerBuilder func(memberName string) *zap.Logger
+ }
+
+ type cluster struct {
+@@ -334,6 +335,7 @@
+ leaseCheckpointInterval: c.cfg.LeaseCheckpointInterval,
+ WatchProgressNotifyInterval: c.cfg.WatchProgressNotifyInterval,
+ CorruptCheckTime: c.cfg.CorruptCheckTime,
++ LoggerBuilder: c.cfg.LoggerBuilder,
+ })
+ m.DiscoveryURL = c.cfg.DiscoveryURL
+ if c.cfg.UseGRPC {
+@@ -638,6 +640,7 @@
+ leaseCheckpointPersist bool
+ WatchProgressNotifyInterval time.Duration
+ CorruptCheckTime time.Duration
++ LoggerBuilder func(memberName string) *zap.Logger
+ }
+
+ // mustNewMember return an inited member with the given name. If peerTLS is
+@@ -747,7 +750,11 @@
+
+ m.V2Deprecation = config.V2_DEPR_DEFAULT
+ m.grpcServerRecorder = &grpc_testing.GrpcRecorder{}
+- m.Logger = memberLogger(t, mcfg.name)
++ if mcfg.LoggerBuilder != nil {
++ m.Logger = mcfg.LoggerBuilder(mcfg.name)
++ } else {
++ m.Logger = memberLogger(t, mcfg.name)
++ }
+ t.Cleanup(func() {
+ // if we didn't cleanup the logger, the consecutive test
+ // might reuse this (t).
diff --git a/third_party/go/repositories.bzl b/third_party/go/repositories.bzl
index 2b780d7..b58c990 100644
--- a/third_party/go/repositories.bzl
+++ b/third_party/go/repositories.bzl
@@ -6198,6 +6198,10 @@
go_repository(
name = "io_etcd_go_etcd_tests_v3",
importpath = "go.etcd.io/etcd/tests/v3",
+ patch_args = ["-p1"],
+ patches = [
+ "//third_party/go/patches:etcd-integration-logging.patch",
+ ],
sum = "h1:wiYG8vbDwZO2UatQE9Z3GIv2z52jGg5DvEkTDXm090c=",
version = "v3.5.4",
)