github.com/etecs-ru/gnomock@v0.13.2/preset/kafka/options.go (about) 1 package kafka 2 3 // Option is an optional configuration of this Gnomock preset. Use available 4 // Options to configure the container. 5 type Option func(*P) 6 7 // WithVersion sets image version. 8 func WithVersion(version string) Option { 9 return func(o *P) { 10 o.Version = version 11 } 12 } 13 14 // WithTopics makes sure that the provided topics are available when Kafka is 15 // up and running. 16 func WithTopics(topics ...string) Option { 17 return func(o *P) { 18 o.Topics = append(o.Topics, topics...) 19 } 20 } 21 22 // WithMessages makes sure that these messages can be consumed during the test 23 // once the container is ready. 24 func WithMessages(messages ...Message) Option { 25 return func(o *P) { 26 o.Messages = append(o.Messages, messages...) 27 } 28 } 29 30 // WithMessagesFile allows to load messages to be sent into Kafka from one or 31 // multiple files. 32 func WithMessagesFile(files string) Option { 33 return func(o *P) { 34 o.MessagesFiles = append(o.MessagesFiles, files) 35 } 36 }