Skip to content

Commit ff0cb1e

Browse files
chrisdennisstoty
authored andcommitted
[CALCITE-6799] ConnectionPropertiesHATest flakey on MacOS
Account for all known connection failure messages. The three failure messages here were sourced from ~100k local runs of this test on macOS.
1 parent 41c88bc commit ff0cb1e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/src/test/java/org/apache/calcite/avatica/ha/ConnectionPropertiesHATest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
import java.util.concurrent.Executors;
5353
import java.util.concurrent.Future;
5454

55+
import static org.hamcrest.CoreMatchers.containsString;
56+
import static org.hamcrest.CoreMatchers.either;
57+
import static org.hamcrest.MatcherAssert.assertThat;
5558
import static org.junit.Assert.assertEquals;
5659
import static org.junit.Assert.assertFalse;
5760
import static org.junit.Assert.assertNotEquals;
@@ -317,9 +320,10 @@ public void testConnectionPropertiesCreateStatementAfterDisconnect() throws Exce
317320
stmt.execute("SELECT count(1) FROM " + tableName);
318321
} catch (Exception e) {
319322
assertTrue(e instanceof SQLException);
320-
assertTrue(
321-
e.getMessage().toLowerCase(Locale.ROOT).contains("connection refused")
322-
|| e.getMessage().toLowerCase(Locale.ROOT).contains("connection abort"));
323+
assertThat(e.getMessage().toLowerCase(Locale.ROOT), either(
324+
containsString("connection refused"))
325+
.or(containsString("connection abort"))
326+
.or(containsString("connection reset")));
323327
}
324328

325329
// Create statement with conn - Fails with HttpHostConnectException.

0 commit comments

Comments
 (0)