Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 0 additions & 123 deletions util/query/pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,129 +215,6 @@ func TestDecodePaginationKey(t *testing.T) {
require.Equal(t, tt.wantUnsol, gotUnsol, "DecodePaginationKey() unexpected unsolicited")
})
}

// tests := []struct {
// name string
// input []byte
// wantStates []byte
// wantPrefix []byte
// wantKey []byte
// wantUnsol []byte
// wantErr bool
// wantErrString string
// }{
//
// {
// name: "invalid states length",
// input: makeTestKey([]byte{5}, []byte{}, []byte{}, nil),
// wantErr: true,
// wantErrString: "pagination: invalid key: invalid state length",
// },
// {
// name: "valid key without unsolicited",
// input: makeTestKey([]byte{1, 2}, []byte{3, 4}, []byte{5, 6}, nil),
// wantStates: []byte{1, 2},
// wantPrefix: []byte{3, 4},
// wantKey: []byte{5, 6},
// wantUnsol: nil,
// wantErr: false,
// },
// {
// name: "valid key with unsolicited",
// input: makeTestKey([]byte{1, 2}, []byte{3, 4}, []byte{5, 6}, []byte{7, 8}),
// wantStates: []byte{1, 2},
// wantPrefix: []byte{3, 4},
// wantKey: []byte{5, 6},
// wantUnsol: []byte{7, 8},
// wantErr: false,
// },
// {
// name: "manually constructed valid checksum",
// input: func() []byte {
// payload := []byte{
// 2, // states count
// 1, 2, // states
// 2, // prefix length
// 3, 4, // prefix
// 2, // key length
// 5, 6, // key
// }
// checksum := crc32.ChecksumIEEE(payload)
// result := make([]byte, 4+len(payload))
// binary.BigEndian.PutUint32(result, checksum)
// copy(result[4:], payload)
// return result
// }(),
// wantStates: []byte{1, 2},
// wantPrefix: []byte{3, 4},
// wantKey: []byte{5, 6},
// wantUnsol: nil,
// wantErr: false,
// },
// {
// name: "corrupted first byte of checksum",
// input: func() []byte {
// payload := []byte{
// 2, // states count
// 1, 2, // states
// 2, // prefix length
// 3, 4, // prefix
// 2, // key length
// 5, 6, // key
// }
// checksum := crc32.ChecksumIEEE(payload)
// result := make([]byte, 4+len(payload))
// binary.BigEndian.PutUint32(result, checksum)
// copy(result[4:], payload)
// result[0]++ // corrupt first byte of checksum
// return result
// }(),
// wantErr: true,
// wantErrString: "pagination: invalid key: invalid checksum",
// },
// {
// name: "corrupted last byte of checksum",
// input: func() []byte {
// payload := []byte{
// 2, // states count
// 1, 2, // states
// 2, // prefix length
// 3, 4, // prefix
// 2, // key length
// 5, 6, // key
// }
// checksum := crc32.ChecksumIEEE(payload)
// result := make([]byte, 4+len(payload))
// binary.BigEndian.PutUint32(result, checksum)
// copy(result[4:], payload)
// result[3]++ // corrupt last byte of checksum
// return result
// }(),
// wantErr: true,
// wantErrString: "pagination: invalid key: invalid checksum",
// },
// {
// name: "corrupted payload with valid checksum",
// input: func() []byte {
// payload := []byte{
// 2, // states count
// 1, 2, // states
// 2, // prefix length
// 3, 4, // prefix
// 2, // key length
// 5, 6, // key
// }
// checksum := crc32.ChecksumIEEE(payload)
// result := make([]byte, 4+len(payload))
// binary.BigEndian.PutUint32(result, checksum)
// copy(result[4:], payload)
// result[5]++ // corrupt payload after checksum
// return result
// }(),
// wantErr: true,
// wantErrString: "pagination: invalid key: invalid checksum",
// },
// }
}

// makeTestKey is a helper function to create a valid pagination key for testing
Expand Down
Loading