diff --git a/util/query/pagination_test.go b/util/query/pagination_test.go index 672d7358c7..790f4459cb 100644 --- a/util/query/pagination_test.go +++ b/util/query/pagination_test.go @@ -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