neo4j-streams icon indicating copy to clipboard operation
neo4j-streams copied to clipboard

Kafka connector Neo4jSourceTaskTest.'should throw exception' is flaky

Open AnatolyPopov opened this issue 2 years ago • 1 comments

Guidelines

Please note that GitHub issues are only meant for bug reports/feature requests. If you have questions on how to use Streams, please ask on StackOverflow instead of creating an issue here.

Expected Behavior (Mandatory)

The Neo4jSourceTaskTest.'should throw exception' should pass.

Actual Behavior (Mandatory)

The test fails sometimes with java.lang.AssertionError: Expected exception: org.apache.kafka.connect.errors.ConnectException. The test seems to be dependent on the test execution order. More specifically it fails if it runs after Neo4jSinkTaskTest.

How to Reproduce the Problem

Run Neo4jSinkTaskTest and then Neo4jSourceTaskTest.'should throw exception' in the same test run.

Simple Dataset (where it's possibile)

//Insert here a set of Cypher statements that helps us to reproduce the problem

Steps (Mandatory)

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions

Versions

  • OS:
  • Neo4j:
  • Neo4j-Streams:

AnatolyPopov avatar Aug 23 '22 12:08 AnatolyPopov

Investigated this a little more. Looks like when the last call to task.poll() in the test is executed the job coroutine in Neo4jSourceService is not yet managed to execute the 'wrong query' provided to it, so task.poll() just returns nothing. So seems there is a race condition between job coroutine in Neo4jSourceService and test thread. However I'm not sure why it does not appear when the test is executed in the isolation.

AnatolyPopov avatar Aug 25 '22 11:08 AnatolyPopov