From 9a38aedf268c5945ed4132181f2cf0ef20fd1a2c Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Wed, 28 Jun 2023 13:24:49 +0000 Subject: [PATCH] roachtest: deflake c2c driver PR #105635 fixed some leaky goroutines in the c2c driver, but also revealed a new bug where a monitor was inadvertently watching the workload node. The workload node shuts down before the monitor, causing the monitor to fail and the test to flake. This patch prevents this monitor from watching the workload node, fixing the infra flake. Fixes #105595 Fixes #105603 Fixes #105600 --- pkg/cmd/roachtest/tests/cluster_to_cluster.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/roachtest/tests/cluster_to_cluster.go b/pkg/cmd/roachtest/tests/cluster_to_cluster.go index 43cda28bc946..93bbe17621bc 100644 --- a/pkg/cmd/roachtest/tests/cluster_to_cluster.go +++ b/pkg/cmd/roachtest/tests/cluster_to_cluster.go @@ -834,17 +834,18 @@ func registerClusterToCluster(r registry.Registry) { func(ctx context.Context, t test.Test, c cluster.Cluster) { rd := makeReplicationDriver(t, c, sp) rd.setupC2C(ctx, t, c) + m := rd.newMonitor(ctx) - m := c.NewMonitor(ctx) hc := roachtestutil.NewHealthChecker(t, c, rd.crdbNodes()) m.Go(func(ctx context.Context) error { require.NoError(t, hc.Runner(ctx)) return nil }) - defer hc.Done() - + defer func() { + hc.Done() + m.Wait() + }() rd.main(ctx) - m.Wait() }) } }