MCPcopy
hub / github.com/segmentio/kafka-go / testWriterRequiredAcksNone

Function testWriterRequiredAcksNone

writer_test.go:226–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224}
225
226func testWriterRequiredAcksNone(t *testing.T) {
227 topic := makeTopic()
228 createTopic(t, topic, 1)
229 defer deleteTopic(t, topic)
230
231 transport := &Transport{}
232 defer transport.CloseIdleConnections()
233
234 writer := &Writer{
235 Addr: TCP("localhost:9092"),
236 Topic: topic,
237 Balancer: &RoundRobin{},
238 RequiredAcks: RequireNone,
239 Transport: transport,
240 }
241 defer writer.Close()
242
243 msg := Message{
244 Key: []byte("ThisIsAKey"),
245 Value: []byte("Test message for required acks test"),
246 }
247
248 err := writer.WriteMessages(context.Background(), msg)
249 if err != nil {
250 t.Fatal(err)
251 }
252}
253
254func testWriterSetsRightBalancer(t *testing.T) {
255 const topic = "test-writer-1"

Callers

nothing calls this directly

Calls 7

CloseIdleConnectionsMethod · 0.95
CloseMethod · 0.95
WriteMessagesMethod · 0.95
createTopicFunction · 0.85
deleteTopicFunction · 0.85
TCPFunction · 0.85
makeTopicFunction · 0.70

Tested by

no test coverage detected