Skip to content

Commit f432f3d

Browse files
committed
Fix for flaky test test_chunks_the_same
This would fail sometimes on Windows / Mac because the clocks used there are less precise and the two [1000, 1001] segments would collide on exactly the same key with LMDB. I just change the test so their content hashes would be different. The test was written to cover an issue with identical index ranges, so it still meets its original purpose. This just changes the tests so that their content hashes differ. Theoretically, this could be a real problem that comes up, and we ought to somehow retry when there is a key clash. But that seems very improbable outside of unit testing, so we leave it as is for now.
1 parent 3e40f14 commit f432f3d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

python/tests/unit/arcticdb/version_store/test_parallel.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1534,14 +1534,13 @@ def test_chunks_match_at_ends(lmdb_storage, lib_name):
15341534
def test_chunks_the_same(lmdb_storage, lib_name):
15351535
"""Given - we stage chunks with indexes:
15361536
1537-
b:test:0:0xc7ad4135da54cd6e@1739968588832977666[1000,2001]
1538-
b:test:0:0x68d8759aba38bcf0@1739968588832775570[1000,1001]
1539-
b:test:0:0x68d8759aba38bcf0@1739968588832621000[1000,1001]
1537+
b:test:0:h1@1739968588832977666[1000,2001]
1538+
b:test:0:h2@1739968588832775570[1000,1001]
1539+
b:test:0:h3@1739968588832621000[1000,1001]
15401540
15411541
When - We finalize the staged segments
15421542
1543-
Then - We should succeed even though the segments seem to be identical, since they are just covering a duplicated
1544-
index value
1543+
Then - We should succeed even though the segments are covering a duplicated index value
15451544
"""
15461545
lib: Library = lmdb_storage.create_arctic().create_library(
15471546
lib_name,
@@ -1556,7 +1555,7 @@ def test_chunks_the_same(lmdb_storage, lib_name):
15561555
pd.Timestamp(2000),
15571556
]
15581557

1559-
data = pd.DataFrame({"a": len(idx)}, index=idx)
1558+
data = pd.DataFrame({"a": np.arange(len(idx))}, index=idx)
15601559
lib.write("test", data, staged=True)
15611560

15621561
lt = lib._nvs.library_tool()

0 commit comments

Comments
 (0)