Skip to content

Commit eeb56e2

Browse files
committed
Disable SSL when not needed in MySQL client tests
By default, the MySQL Client prefers SSL if available on the server. But since we have a self-signed certificate for testing, the client does not accept it. Therefore, it fallbacks to no SSL and creates two connections in total. That is why a couple metrics test fail, because the test expect only one connection to be closed. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent c4a00e7 commit eeb56e2

File tree

1 file changed

+6
-1
lines changed
  • vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/junit

1 file changed

+6
-1
lines changed

vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/junit/MySQLRule.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import com.github.dockerjava.api.model.Ulimit;
1414
import io.vertx.mysqlclient.MySQLConnectOptions;
15+
import io.vertx.mysqlclient.SslMode;
1516
import org.junit.rules.ExternalResource;
1617
import org.testcontainers.containers.BindMode;
1718
import org.testcontainers.containers.GenericContainer;
@@ -50,12 +51,16 @@ public synchronized MySQLConnectOptions startServer() throws Exception {
5051
initServer();
5152
server.start();
5253

53-
return new MySQLConnectOptions()
54+
MySQLConnectOptions connectOptions = new MySQLConnectOptions()
5455
.setPort(server.getMappedPort(3306))
5556
.setHost(server.getHost())
5657
.setDatabase("testschema")
5758
.setUser("mysql")
5859
.setPassword("password");
60+
if (!ssl) {
61+
connectOptions.setSslMode(SslMode.DISABLED);
62+
}
63+
return connectOptions;
5964
}
6065

6166
public synchronized void stopServer() throws Exception {

0 commit comments

Comments
 (0)