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

Function TestSASLAuthenticateRequestV0

saslauthenticate_test.go:10–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestSASLAuthenticateRequestV0(t *testing.T) {
11 item := saslAuthenticateRequestV0{
12 Data: []byte("\x00user\x00pass"),
13 }
14
15 b := bytes.NewBuffer(nil)
16 w := &writeBuffer{w: b}
17 item.writeTo(w)
18
19 var found saslAuthenticateRequestV0
20 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
21 if err != nil {
22 t.Error(err)
23 t.FailNow()
24 }
25 if remain != 0 {
26 t.Errorf("expected 0 remain, got %v", remain)
27 t.FailNow()
28 }
29 if !reflect.DeepEqual(item, found) {
30 t.Error("expected item and found to be the same")
31 t.FailNow()
32 }
33}
34
35func TestSASLAuthenticateResponseV0(t *testing.T) {
36 item := saslAuthenticateResponseV0{

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