Configure Kafka container for testing with topics, messages, and schema registry options.
// Source: https://github.com/orlangure/gnomock | License: MIT | Copyright 2020 Yury Fedorov
// Provided via justclaw.it.com; keep this notice with the code.
package kafka
// Option is an optional configuration of this Gnomock preset. Use available
// Options to configure the container.
type Option func(*P)
// WithVersion sets image version.
func WithVersion(version string) Option {
return func(o *P) {
o.Version = version
}
}
// WithTopics makes sure that the provided topics are available when Kafka is
// up and running.
// Both topics from WithTopics and WithTopicConfigs will be added to Kafka.
func WithTopics(topics ...string) Option {
return func(o *P) {
o.Topics = append(o.Topics, topics...)
}
}
// WithTopicConfigs makes sure that the provided topics with the given configs
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key