test: make flaky neo4j integration test less flaky #15492
Merged
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.
I have noticed that tests/integration/neo4j/test_neo4j.py (in testIntegrationBatch2) is flaky and often fails with one or two of the Urns missing below:
Urn removed, urn:li:dataset:(urn:li:dataPlatform:neo4j,test_instance.SIMILAR_TO,TEST)
Urn removed, urn:li:dataset:(urn:li:dataPlatform:neo4j,test_instance.FOLLOWS,TEST)
It looks to me like the data is not always ready when the test starts. Wait for more objects to be ready in the database should make it less flaky.
It has failed about 10% (33 of 319) of all the runs the last 2 weeks.
I did run this test repeatedly locally (while having some random load on my computer) and every time it failed after 10-20 runs. I also noticed that then it only gets a few results from the
MATCH (n) RETURN count(n) as countquery. When I changed the threshold to wait for a count of at least 10 the test ran without errors. From my logging I saw that it typically only took one extra check to get from 2-4 to 17-19 (19 seems to be max).