Skip to content

Commit 7248f2c

Browse files
Fixed #535: Kafka connector Neo4jSourceTaskTest.'should throw exception' is flaky (#579)
1 parent 6ab213e commit 7248f2c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kafka-connect-neo4j/src/test/kotlin/streams/kafka/connect/source/Neo4jSourceTaskTest.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,17 @@ class Neo4jSourceTaskTest {
290290
val totalRecords = 10
291291
insertRecords(totalRecords)
292292

293-
task.poll()
293+
var exception: ConnectException? = null
294+
Assert.assertEventually(ThrowingSupplier<Boolean, Exception> {
295+
try {
296+
task.poll()
297+
false
298+
} catch (e: ConnectException) {
299+
exception = e
300+
true
301+
}
302+
}, Matchers.equalTo(true), 30, TimeUnit.SECONDS)
303+
if (exception != null) throw exception as ConnectException
294304
}
295305

296306
@Test

0 commit comments

Comments
 (0)