mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
alternator test: fix test wrongly failing on AWS
The test test_query_filter.py::test_query_filter_paging fails on AWS and shouldn't fail, so this patch fixes the test. Note that this is only a test problem - no fix is needed for Alternator itself. The test reads 20 results with 1-result pages, and assumed that 21 pages are returned. The 21st page may happen because when the server returns the 20th, it might not yet know there will be no additional results, so another page is needed - and will be empty. Still a different implementation might notice that the last page completed the iteration, and not return an extra empty page. This is perfectly fine, and this is what AWS DynamoDB does today - and should not be considered an error. Refs #7778 Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20201213143612.2761943-1-nyh@scylladb.com>
This commit is contained in:
committed by
Piotr Sarna
parent
4ab98a4c68
commit
43ce0aef3d
@@ -529,11 +529,15 @@ def test_query_filter_paging(test_table_sn_with_data):
|
||||
Limit=1)
|
||||
expected_items = [item for item in items if item['bool'] == True]
|
||||
assert(got_items == expected_items)
|
||||
# We expect the number of pages to be len(items)+1. The "+1" is because
|
||||
# the 20th page found one last item to consider (it may or may not have
|
||||
# passed the filter), but doesn't know it is really the last item - it
|
||||
# takes one more query to discover there are no more.
|
||||
assert(pages == len(items) + 1)
|
||||
# The total number of pages may be len(items) or len(items)+1, depending
|
||||
# on the implementation: The "+1" can happen if the 20th page found one
|
||||
# last item to consider (it may or may not have passed the filter), but
|
||||
# doesn't know it is really the last item - it may take one more query to
|
||||
# discover there are no more. Currently, Alternator returns len(items)+1
|
||||
# while DynamoDB returns len(items), but neither is more correct than the
|
||||
# other - nor should any user case about this difference, as empty pages
|
||||
# are a documented possibility.
|
||||
assert(pages == len(items) or pages == len(items) + 1)
|
||||
|
||||
# Test that a QueryFilter and AttributesToGet may be given together.
|
||||
# In particular, test that QueryFilter may inspect attributes which will
|
||||
|
||||
Reference in New Issue
Block a user