Skip to content

Commit b57550f

Browse files
committed
GH-62: relax JDBC cancellation test assertion
1 parent 7680330 commit b57550f

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ResultSetTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,14 @@ public void testShouldCancelQueryUponCancelAfterQueryingResultSet() throws SQLEx
302302
@Test
303303
public void testShouldInterruptFlightStreamsIfQueryIsCancelledMidQuerying()
304304
throws SQLException, InterruptedException {
305+
final String query = CoreMockedSqlProducers.LEGACY_REGULAR_SQL_CMD;
305306
try (final Statement statement = connection.createStatement()) {
306307
final CountDownLatch latch = new CountDownLatch(1);
307308
final Set<Exception> exceptions = synchronizedSet(new HashSet<>(1));
308309
final Thread thread =
309310
new Thread(
310311
() -> {
311-
try (final ResultSet resultSet =
312-
statement.executeQuery(CoreMockedSqlProducers.LEGACY_REGULAR_SQL_CMD)) {
312+
try (final ResultSet resultSet = statement.executeQuery(query)) {
313313
final int cachedColumnCount = resultSet.getMetaData().getColumnCount();
314314
Thread.sleep(300);
315315
while (resultSet.next()) {
@@ -332,7 +332,14 @@ public void testShouldInterruptFlightStreamsIfQueryIsCancelledMidQuerying()
332332
.reduce(StringBuilder::append)
333333
.orElseThrow(IllegalArgumentException::new)
334334
.toString(),
335-
is("Statement canceled"));
335+
anyOf(
336+
is("Statement canceled"),
337+
allOf(
338+
containsString(format("Error while executing SQL \"%s\"", query)),
339+
anyOf(
340+
containsString("Query canceled"),
341+
containsString("CANCELLED"),
342+
containsString("Cancelling")))));
336343
}
337344
}
338345

0 commit comments

Comments
 (0)