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

Function TestRequiredAcks

produce_test.go:12–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestRequiredAcks(t *testing.T) {
13 for _, acks := range []RequiredAcks{
14 RequireNone,
15 RequireOne,
16 RequireAll,
17 } {
18 t.Run(acks.String(), func(t *testing.T) {
19 a := strconv.Itoa(int(acks))
20 x := RequiredAcks(-2)
21 y := RequiredAcks(-2)
22 b, err := acks.MarshalText()
23 if err != nil {
24 t.Fatal(err)
25 }
26
27 if err := x.UnmarshalText([]byte(a)); err != nil {
28 t.Fatal(err)
29 }
30 if err := y.UnmarshalText(b); err != nil {
31 t.Fatal(err)
32 }
33
34 if x != acks {
35 t.Errorf("required acks mismatch after marshal/unmarshal text: want=%s got=%s", acks, x)
36 }
37 if y != acks {
38 t.Errorf("required acks mismatch after marshal/unmarshal value: want=%s got=%s", acks, y)
39 }
40 })
41 }
42}
43
44func TestClientProduce(t *testing.T) {
45 client, topic, shutdown := newLocalClientAndTopic()

Callers

nothing calls this directly

Calls 4

RequiredAcksTypeAlias · 0.85
StringMethod · 0.45
MarshalTextMethod · 0.45
UnmarshalTextMethod · 0.45

Tested by

no test coverage detected