From f66d4957115f2b79cb613049fef4f942d9ca287b Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Thu, 28 Nov 2024 12:33:06 -0700 Subject: [PATCH] kfake: do not listen until the cluster is fully set up --- pkg/kfake/cluster.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kfake/cluster.go b/pkg/kfake/cluster.go index 275b1440..3720cf61 100644 --- a/pkg/kfake/cluster.go +++ b/pkg/kfake/cluster.go @@ -183,10 +183,9 @@ func NewCluster(opts ...Opt) (*Cluster, error) { bsIdx: len(c.bs), } c.bs = append(c.bs, b) - go b.listen() + defer func() { go b.listen() }() } c.controller = c.bs[len(c.bs)-1] - go c.run() seedTopics := make(map[string]int32) for _, sts := range cfg.seedTopics { @@ -201,6 +200,9 @@ func NewCluster(opts ...Opt) (*Cluster, error) { for t, p := range seedTopics { c.data.mkt(t, int(p), -1, nil) } + + go c.run() + return c, nil }