orchestrator/kafka: force metadata refresh during tests

New versions of kadm cache metadata by default. Ask a refresh to avoid
that.
This commit is contained in:
Vincent Bernat
2025-10-22 08:31:30 +02:00
parent eca3ff01b8
commit 4390c89c52
2 changed files with 9 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ func (c *Component) Start() error {
return fmt.Errorf("unable to create topic %q: %w", c.kafkaTopic, err)
}
l.Info().Msg("topic created")
client.ForceMetadataRefresh()
} else {
nbPartitions := len(topic.Partitions)
if nbPartitions > int(c.config.TopicConfiguration.NumPartitions) {
@@ -95,6 +96,7 @@ func (c *Component) Start() error {
c.kafkaTopic, err)
}
l.Info().Msg("number of partitions increased")
client.ForceMetadataRefresh()
}
if int(c.config.TopicConfiguration.ReplicationFactor) != topic.Partitions.NumReplicas() {
// TODO: https://github.com/deviceinsight/kafkactl/blob/main/internal/topic/topic-operation.go
@@ -136,6 +138,7 @@ func (c *Component) Start() error {
c.kafkaTopic, err)
}
l.Info().Msg("topic updated")
client.ForceMetadataRefresh()
}
}
return nil