diff --git a/src/test/java/org/mariadb/r2dbc/BaseConnectionTest.java b/src/test/java/org/mariadb/r2dbc/BaseConnectionTest.java index 13a85a8..e2eb128 100644 --- a/src/test/java/org/mariadb/r2dbc/BaseConnectionTest.java +++ b/src/test/java/org/mariadb/r2dbc/BaseConnectionTest.java @@ -122,6 +122,30 @@ public static Integer maxAllowedPacket() { .block(); } + public static Integer getMaxScaleVersion() { + if ("maxscale".equals(System.getenv("srv"))) { + /** + * The test system must either create the maxscale_version() function + * that returns the MaxScale version as an integer or MaxScale must be + * configured with a regexfilter that replaces the SQL with something + * that returns it as a constant. + * + * [InjectVersion] + * type=filter + * module=regexfilter + * match=SELECT maxscale_version() + * replace=SELECT 230800 + */ + return sharedConnPrepare + .createStatement("SELECT maxscale_version()") + .execute() + .flatMap(r -> r.map((row, metadata) -> row.get(0, Integer.class))) + .single() + .block(); + } + return 0; + } + public void assertThrows( Class expectedType, Executable executable, String expected) { Exception e = Assertions.assertThrows(expectedType, executable); diff --git a/src/test/java/org/mariadb/r2dbc/integration/RedirectionTest.java b/src/test/java/org/mariadb/r2dbc/integration/RedirectionTest.java index f4b05e4..0dc1f12 100644 --- a/src/test/java/org/mariadb/r2dbc/integration/RedirectionTest.java +++ b/src/test/java/org/mariadb/r2dbc/integration/RedirectionTest.java @@ -169,7 +169,7 @@ void redirectionDuringPipeline() throws Exception { @Test void connectionRedirection() throws Exception { // need maxscale 23.08+ - Assumptions.assumeTrue("maxscale".equals(System.getenv("srv"))); + Assumptions.assumeTrue(getMaxScaleVersion() >= 230800); try { proxy = new TcpProxy(