Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KafkaContainer ¶
KafkaContainer is a reference to the docker kafka running Kafka (or RedPanda).
func RequireKafka ¶
func RequireKafka(t *testing.T, opts KafkaOpts) *KafkaContainer
RequireKafka starts a Kafka-compatible API in a docker container, serving on port 9092, and creates the requested topic. If the Kafka API is already healthy on 9092, no new containers will be started, but the topic will still be created.
By default, the Kafka API is served by RedPanda as it starts significantly faster, but real Kafka can be used by setting the Provider option to KafkaProviderKafka.
type KafkaOpts ¶
type KafkaOpts struct { Topic string // Create topic NumPartitions int // Number of partitions to create for topic Provider KafkaProvider // The Kafka provider, RedPanda or Kafka. If not set, RedPanda is used. }
KafkaOpts configures options for starting the test Kafka API.
type KafkaProvider ¶
type KafkaProvider string
const ( KafkaProviderRedPanda KafkaProvider = "redpanda" KafkaProviderKafka KafkaProvider = "kafka" )
func NewKafkaProviderFlag ¶
func NewKafkaProviderFlag() *KafkaProvider
NewKafkaProviderFlag initializes the -kafka-provider flag and returns a pointer to the parsed value. This must be called before flag.Parse().