@@ -215,129 +215,6 @@ func TestDecodePaginationKey(t *testing.T) {
215215 require .Equal (t , tt .wantUnsol , gotUnsol , "DecodePaginationKey() unexpected unsolicited" )
216216 })
217217 }
218-
219- // tests := []struct {
220- // name string
221- // input []byte
222- // wantStates []byte
223- // wantPrefix []byte
224- // wantKey []byte
225- // wantUnsol []byte
226- // wantErr bool
227- // wantErrString string
228- // }{
229- //
230- // {
231- // name: "invalid states length",
232- // input: makeTestKey([]byte{5}, []byte{}, []byte{}, nil),
233- // wantErr: true,
234- // wantErrString: "pagination: invalid key: invalid state length",
235- // },
236- // {
237- // name: "valid key without unsolicited",
238- // input: makeTestKey([]byte{1, 2}, []byte{3, 4}, []byte{5, 6}, nil),
239- // wantStates: []byte{1, 2},
240- // wantPrefix: []byte{3, 4},
241- // wantKey: []byte{5, 6},
242- // wantUnsol: nil,
243- // wantErr: false,
244- // },
245- // {
246- // name: "valid key with unsolicited",
247- // input: makeTestKey([]byte{1, 2}, []byte{3, 4}, []byte{5, 6}, []byte{7, 8}),
248- // wantStates: []byte{1, 2},
249- // wantPrefix: []byte{3, 4},
250- // wantKey: []byte{5, 6},
251- // wantUnsol: []byte{7, 8},
252- // wantErr: false,
253- // },
254- // {
255- // name: "manually constructed valid checksum",
256- // input: func() []byte {
257- // payload := []byte{
258- // 2, // states count
259- // 1, 2, // states
260- // 2, // prefix length
261- // 3, 4, // prefix
262- // 2, // key length
263- // 5, 6, // key
264- // }
265- // checksum := crc32.ChecksumIEEE(payload)
266- // result := make([]byte, 4+len(payload))
267- // binary.BigEndian.PutUint32(result, checksum)
268- // copy(result[4:], payload)
269- // return result
270- // }(),
271- // wantStates: []byte{1, 2},
272- // wantPrefix: []byte{3, 4},
273- // wantKey: []byte{5, 6},
274- // wantUnsol: nil,
275- // wantErr: false,
276- // },
277- // {
278- // name: "corrupted first byte of checksum",
279- // input: func() []byte {
280- // payload := []byte{
281- // 2, // states count
282- // 1, 2, // states
283- // 2, // prefix length
284- // 3, 4, // prefix
285- // 2, // key length
286- // 5, 6, // key
287- // }
288- // checksum := crc32.ChecksumIEEE(payload)
289- // result := make([]byte, 4+len(payload))
290- // binary.BigEndian.PutUint32(result, checksum)
291- // copy(result[4:], payload)
292- // result[0]++ // corrupt first byte of checksum
293- // return result
294- // }(),
295- // wantErr: true,
296- // wantErrString: "pagination: invalid key: invalid checksum",
297- // },
298- // {
299- // name: "corrupted last byte of checksum",
300- // input: func() []byte {
301- // payload := []byte{
302- // 2, // states count
303- // 1, 2, // states
304- // 2, // prefix length
305- // 3, 4, // prefix
306- // 2, // key length
307- // 5, 6, // key
308- // }
309- // checksum := crc32.ChecksumIEEE(payload)
310- // result := make([]byte, 4+len(payload))
311- // binary.BigEndian.PutUint32(result, checksum)
312- // copy(result[4:], payload)
313- // result[3]++ // corrupt last byte of checksum
314- // return result
315- // }(),
316- // wantErr: true,
317- // wantErrString: "pagination: invalid key: invalid checksum",
318- // },
319- // {
320- // name: "corrupted payload with valid checksum",
321- // input: func() []byte {
322- // payload := []byte{
323- // 2, // states count
324- // 1, 2, // states
325- // 2, // prefix length
326- // 3, 4, // prefix
327- // 2, // key length
328- // 5, 6, // key
329- // }
330- // checksum := crc32.ChecksumIEEE(payload)
331- // result := make([]byte, 4+len(payload))
332- // binary.BigEndian.PutUint32(result, checksum)
333- // copy(result[4:], payload)
334- // result[5]++ // corrupt payload after checksum
335- // return result
336- // }(),
337- // wantErr: true,
338- // wantErrString: "pagination: invalid key: invalid checksum",
339- // },
340- // }
341218}
342219
343220// makeTestKey is a helper function to create a valid pagination key for testing
0 commit comments