MCPcopy
hub / github.com/IBM/sarama / TestFetchRequest

Function TestFetchRequest

fetch_request_test.go:79–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77)
78
79func TestFetchRequest(t *testing.T) {
80 t.Run("no blocks", func(t *testing.T) {
81 request := new(FetchRequest)
82 testRequest(t, "no blocks", request, fetchRequestNoBlocks)
83 })
84
85 t.Run("with properties", func(t *testing.T) {
86 request := new(FetchRequest)
87 request.MaxWaitTime = 0x20
88 request.MinBytes = 0xEF
89 testRequest(t, "with properties", request, fetchRequestWithProperties)
90 })
91
92 t.Run("one block", func(t *testing.T) {
93 request := new(FetchRequest)
94 request.MaxWaitTime = 0
95 request.MinBytes = 0
96 request.AddBlock("topic", 0x12, 0x34, 0x56, -1)
97 testRequest(t, "one block", request, fetchRequestOneBlock)
98 })
99
100 t.Run("one block v4", func(t *testing.T) {
101 request := new(FetchRequest)
102 request.Version = 4
103 request.MaxBytes = 0xFF
104 request.Isolation = ReadCommitted
105 request.AddBlock("topic", 0x12, 0x34, 0x56, -1)
106 testRequest(t, "one block v4", request, fetchRequestOneBlockV4)
107 })
108
109 t.Run("one block v11 rackid and leader epoch", func(t *testing.T) {
110 request := new(FetchRequest)
111 request.Version = 11
112 request.MaxBytes = 0xFF
113 request.Isolation = ReadCommitted
114 request.SessionID = 0xAA
115 request.SessionEpoch = 0xEE
116 request.AddBlock("topic", 0x12, 0x34, 0x56, 0x66)
117 request.RackID = "rack01"
118 testRequest(t, "one block v11 rackid", request, fetchRequestOneBlockV11)
119 })
120
121 t.Run("one block v12 flexible", func(t *testing.T) {
122 request := new(FetchRequest)
123 request.Version = 12
124 request.MaxBytes = 0xFF
125 request.Isolation = ReadCommitted
126 request.SessionID = 0xAA
127 request.SessionEpoch = 0xEE
128 request.AddBlock("topic", 0x12, 0x34, 0x56, 0x66)
129 request.RackID = "rack01"
130 testRequest(t, "one block v12 flexible", request, fetchRequestOneBlockV12)
131 })
132}

Callers

nothing calls this directly

Calls 3

testRequestFunction · 0.85
RunMethod · 0.80
AddBlockMethod · 0.45

Tested by

no test coverage detected