diff --git a/backend/provisioner/dev_provisioner.go b/backend/provisioner/dev_provisioner.go index e8ee39ec2..6855961f7 100644 --- a/backend/provisioner/dev_provisioner.go +++ b/backend/provisioner/dev_provisioner.go @@ -226,7 +226,7 @@ func provisionTopic() InMemResourceProvisionerFn { } } else if topicMetas[0].Err != sarama.ErrNoError { return nil, fmt.Errorf("failed to describe topic %q: %w", topicID, topicMetas[0].Err) - } else if len(topicMetas[0].Partitions) != partitions { + } else if len(topicMetas[0].Partitions) > partitions { var plural string if len(topicMetas[0].Partitions) == 1 { plural = "partition" @@ -234,6 +234,10 @@ func provisionTopic() InMemResourceProvisionerFn { plural = "partitions" } logger.Warnf("Using existing topic %s with %d %s instead of %d", topicID, len(topicMetas[0].Partitions), plural, partitions) + } else if len(topicMetas[0].Partitions) < partitions { + if err := admin.CreatePartitions(topicID, int32(partitions), nil, false); err != nil { + return nil, fmt.Errorf("failed to increase partitions: %w", err) + } } return &schema.TopicRuntimeEvent{