Skip to content

Commit

Permalink
Merge pull request #211 from kevkim-codes/main
Browse files Browse the repository at this point in the history
fix: update conformance test to determine if request is full table scan
  • Loading branch information
mutianf authored Dec 3, 2024
2 parents 198188e + 9e4daca commit db4d6a9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/readrows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,19 @@ func TestReadRows_Retry_PausedScan(t *testing.T) {
origReq := <-recorder
retryReq := <-recorder
if diff := cmp.Diff(clientReq, origReq.req, protocmp.Transform(), protocmp.IgnoreEmptyMessages()); diff != "" {
t.Errorf("diff found (-want +got):\n%s", diff)
origRows := origReq.req.GetRows()
// Check if rows or row ranges are present in requests. This is a workaround for the NodeJS client.
// In Node we add an empty row range to a full table scan request to simplify the resumption logic.
if origRows == nil || origRows.GetRowRanges() == nil {
// If rows don't exist in either request, skip the comparison
t.Logf("Skipping rows comparison: As this is a full table scan")
} else if len(origRows.GetRowRanges()) == 1 && origRows.GetRowRanges()[0].GetStartKey() == nil && origRows.GetRowRanges()[0].GetEndKey() == nil {
// If rows don't exist in either request, skip the comparison
t.Logf("Skipping rows comparison: As this is a full table scan")
} else {
// Otherwise, proceed with the comparison and report any differences
t.Errorf("diff found (-want +got):\n%s", diff)
}
}
assert.True(t, cmp.Equal(retryReq.req.GetRows().GetRowRanges()[0].StartKey, &btpb.RowRange_StartKeyOpen{StartKeyOpen: []byte("row-01")}))
}
Expand Down

0 comments on commit db4d6a9

Please sign in to comment.