Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check MaxScale version #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/test/java/org/mariadb/r2dbc/BaseConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends Exception> expectedType, Executable executable, String expected) {
Exception e = Assertions.assertThrows(expectedType, executable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down