diff --git a/sql/src/test/java/io/druid/sql/avatica/DruidAvaticaHandlerTest.java b/sql/src/test/java/io/druid/sql/avatica/DruidAvaticaHandlerTest.java index 4e5b88f581c..7b141ae3b9d 100644 --- a/sql/src/test/java/io/druid/sql/avatica/DruidAvaticaHandlerTest.java +++ b/sql/src/test/java/io/druid/sql/avatica/DruidAvaticaHandlerTest.java @@ -96,7 +96,8 @@ public class DruidAvaticaHandlerTest @Override public int getMaxConnections() { - return 2; + // This must match the number of Connection objects created in setUp() + return 3; } @Override @@ -667,9 +668,13 @@ public class DruidAvaticaHandlerTest final Connection connection2 = DriverManager.getConnection(url); final Statement statement2 = connection2.createStatement(); - expectedException.expect(AvaticaClientRuntimeException.class); - expectedException.expectMessage("Too many connections, limit is[2]"); final Connection connection3 = DriverManager.getConnection(url); + final Statement statement3 = connection3.createStatement(); + + expectedException.expect(AvaticaClientRuntimeException.class); + expectedException.expectMessage("Too many connections, limit is[3]"); + + final Connection connection4 = DriverManager.getConnection(url); } @Test @@ -682,6 +687,9 @@ public class DruidAvaticaHandlerTest connection2.createStatement().close(); final Connection connection3 = DriverManager.getConnection(url); + connection3.createStatement().close(); + + final Connection connection4 = DriverManager.getConnection(url); Assert.assertTrue(true); }