test(backend): allow a slow Kafka start and log its tail on failure

This commit is contained in:
shira committed 2026-10-06 13:53:26 +03:00
1 parent 8378ad45b0
commit 7e80c8ad2a
2 files changed
+36 -6

No files matched your search

@@ -610,7 +610,7 @@ func newConsumerGroup() string {
// newSource creates a group member for topic. close leaves the group; it
// also runs when t finishes, after the consumer stopped.
func (harness *consumerHarness) newSource(t *testing.T, topic, group string) (source *kafka.EventSource, close func()) {
func (harness *consumerHarness) newSource(t *testing.T, topic, group string) (source *kafka.EventSource, closeOnce func()) {
t.Helper()
settings := harness.env.Config
settings.KafkaEventsTopic = topic
@@ -620,9 +620,9 @@ func (harness *consumerHarness) newSource(t *testing.T, topic, group string) (so
t.Fatalf("NewEventSource() error = %v", err)
}
var once sync.Once
close = func() { once.Do(closeSource) }
t.Cleanup(close)
return source, close
closeOnce = func() { once.Do(closeSource) }
t.Cleanup(closeOnce)
return source, closeOnce
}
func (harness *consumerHarness) startConsumer(