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

Function TestSASLHandshakeResponseV0

saslhandshake_test.go:35–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestSASLHandshakeResponseV0(t *testing.T) {
36 item := saslHandshakeResponseV0{
37 ErrorCode: 2,
38 EnabledMechanisms: []string{"PLAIN", "SCRAM-SHA-512"},
39 }
40
41 b := bytes.NewBuffer(nil)
42 w := &writeBuffer{w: b}
43 item.writeTo(w)
44
45 var found saslHandshakeResponseV0
46 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
47 if err != nil {
48 t.Error(err)
49 t.FailNow()
50 }
51 if remain != 0 {
52 t.Errorf("expected 0 remain, got %v", remain)
53 t.FailNow()
54 }
55 if !reflect.DeepEqual(item, found) {
56 t.Error("expected item and found to be the same")
57 t.FailNow()
58 }
59}

Callers

nothing calls this directly

Calls 5

writeToMethod · 0.95
NewReaderMethod · 0.65
LenMethod · 0.65
readFromMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected