-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tdl 14376 pagination failure #50
Merged
prijendev
merged 8 commits into
TDL-15623-Crest-Master
from
TDL-14376-Pagination-failure
Dec 13, 2021
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5db95bd
Initial commit for pagination failer
prijendev 6cb0d95
Merge remote-tracking branch 'origin/TDL-15623-Crest-Master' into TDL…
prijendev 136c84b
Fixed pagination test cases
prijendev 93185b6
Added comments
prijendev ab60957
Added detail comment into the code
prijendev 6ee91a5
Removed unnecessary comment
prijendev 25136fc
Removed unnecessary assertion
prijendev 2cf83bc
Removed extra comment
prijendev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ def test_run(self): | |
Verify that for each stream you can get multiple pages of data | ||
and that when all fields are selected more than the automatic fields are replicated. | ||
|
||
Verify by primary keys that data is unique for page | ||
PREREQUISITE | ||
This test relies on the existence of a specific sheet with the name Pagination that has a column | ||
called 'id' with values 1 -> 238. | ||
|
@@ -43,9 +44,8 @@ def test_run(self): | |
record_count_by_stream = self.run_and_verify_sync(conn_id) | ||
synced_records = runner.get_records_from_target_output() | ||
|
||
for stream in testable_streams.difference({ | ||
'sadsheet-pagination', # BUG TDL-14376 | ||
}): | ||
# Added back `sadsheet-pagination` to testable_streams as # BUG TDL-14376 resolved. | ||
kspeer825 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for stream in testable_streams: | ||
with self.subTest(stream=stream): | ||
|
||
our_fake_pk = 'id' | ||
|
@@ -61,6 +61,22 @@ def test_run(self): | |
# verify that we can paginate with all fields selected | ||
self.assertGreater(record_count_by_stream.get(stream, 0), self.API_LIMIT) | ||
|
||
|
||
if stream == "sadsheet-pagination": | ||
# verify the data for the "sadsheet-pagination" stream is free of any duplicates or breaks by checking | ||
# our fake pk value ('id') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a detailed comment about the data present in this sheet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
expected_pk_list = list(range(1, 238)) | ||
expected_pk_list = [x for x in expected_pk_list if x not in [198, 199]] | ||
self.assertEqual(expected_pk_list, fake_pk_list) | ||
|
||
# verify the data for the "sadsheet-pagination" stream is free of any duplicates or breaks by checking | ||
# the actual primary key values (__sdc_row) | ||
expected_pk_list = list(range(2, 239)) | ||
expected_pk_list = [x for x in expected_pk_list if x not in [199, 200]] | ||
self.assertEqual(expected_pk_list, actual_pk_list) | ||
|
||
continue | ||
|
||
# verify the data for the "Pagination" stream is free of any duplicates or breaks by checking | ||
# our fake pk value ('id') | ||
# THIS ASSERTION CAN BE MADE BECAUSE WE SETUP DATA IN A SPECIFIC WAY. DONT COPY THIS | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prijendev Can you please explain what the earlier behavior
row_num < to_row:
meant?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here,
to_row
is initialized with a minimum of 200(max page size) ormax_row
. Then, it continues to add 200 untilmax_row
. Initially,from_row
is assigned by 2, and from the next page, it is assigned byto_row
+1.(201 in second page).row_num
is the addition offrom_row
and total records get in response. The above condition checks that if row_num is less than to_row or not based on which it set is_last_row true. But API does not return the last empty rows in response.For example, rows 199 and 200 are empty, and a total 400 rows are there in the sheet. So, in 1st iteration
to_row
= 200from_row
= 2row_num
= 2 + 197 = 199(1st row contain header value)So, the above condition becomes true and breaks the loop.