Skip to content

Commit b04736a

Browse files
author
Chava Goldshtein
committed
fix: sort records in chunked processing test for consistent ordering
Fix test failure by sorting records by ID before validation to ensure consistent results regardless of database return order.
1 parent 3fd779c commit b04736a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ckanext/xloader/tests/test_chunks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ def test_chunked_processing_large_file(self, Session: Any) -> None:
117117
assert column_names == expected_columns
118118

119119
# Verify first and last records to ensure data integrity
120-
first_record = records[0]
121-
last_record = records[-1]
120+
# Sort records by the 'id' column (index 1) to ensure consistent ordering
121+
sorted_records = sorted(records, key=lambda x: int(x[1]))
122+
first_record = sorted_records[0]
123+
last_record = sorted_records[-1]
122124

123125
# Check first record (excluding _id and _full_text columns)
124126
# The _get_records method excludes _full_text by default, so indices are:

0 commit comments

Comments
 (0)