Skip to content

Commit f5c4b3d

Browse files
committed
fix: simple connectivity test for each plugin
1 parent eaf9108 commit f5c4b3d

File tree

1 file changed

+29
-37
lines changed

1 file changed

+29
-37
lines changed

wrapper/src/test/java/integration/container/tests/BasicConnectivityTests.java

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,39 @@ public void test_ProxiedDirectConnection(TestDriver testDriver) throws SQLExcept
223223
conn.close();
224224
}
225225

226-
@ParameterizedTest
226+
@TestTemplate
227227
@EnableOnNumOfInstances(min = 2)
228228
@EnableOnDatabaseEngineDeployment({DatabaseEngineDeployment.AURORA, DatabaseEngineDeployment.RDS_MULTI_AZ_CLUSTER})
229-
@MethodSource("testPluginParameters")
230-
public void testBasicConnectivityTestWithPlugins(String plugin, String url) throws SQLException {
231-
final Properties props = getDefaultProperties();
232-
props.setProperty(PropertyDefinition.PLUGINS.name, plugin);
233-
LOGGER.finest("Connecting to " + url);
229+
public void testBasicConnectivityTestWithPlugins() throws SQLException {
230+
final TestInstanceInfo readerInstance = TestEnvironment.getCurrent()
231+
.getInfo()
232+
.getDatabaseInfo()
233+
.getInstances()
234+
.get(1);
234235

235-
try (Connection conn = DriverManager.getConnection(url, props);
236-
Statement stmt = conn.createStatement();
237-
ResultSet rs = stmt.executeQuery("SELECT 1");
238-
) {
239-
assertTrue(rs.next());
240-
assertEquals(1, rs.getInt(1));
236+
final List<String> urls = Arrays.asList(
237+
ConnectionStringHelper.getWrapperUrl(),
238+
ConnectionStringHelper.getWrapperUrl(readerInstance),
239+
ConnectionStringHelper.getWrapperClusterEndpointUrl(),
240+
ConnectionStringHelper.getWrapperReaderClusterUrl()
241+
);
242+
243+
for (String url : urls) {
244+
for (String plugin : PLUGINS) {
245+
final Properties props = getDefaultProperties();
246+
props.setProperty(PropertyDefinition.PLUGINS.name, plugin);
247+
LOGGER.finest("Connecting to " + url);
248+
249+
try (Connection conn = DriverManager.getConnection(url, props);
250+
Statement stmt = conn.createStatement();
251+
ResultSet rs = stmt.executeQuery("SELECT 1");
252+
) {
253+
assertTrue(rs.next());
254+
assertEquals(1, rs.getInt(1));
255+
}
256+
}
241257
}
258+
242259
}
243260

244261
@TestTemplate
@@ -474,29 +491,4 @@ private static Stream<Arguments> testPropertiesParameters() {
474491
}
475492
return results.stream();
476493
}
477-
478-
private static Stream<Arguments> testPluginParameters() {
479-
final List<Arguments> results = new ArrayList<>();
480-
final TestInstanceInfo readerInstance = TestEnvironment.getCurrent()
481-
.getInfo()
482-
.getDatabaseInfo()
483-
.getInstances()
484-
.get(1);
485-
final String writerInstanceUrl = ConnectionStringHelper.getWrapperUrl();
486-
final String readerInstanceUrl = ConnectionStringHelper.getWrapperUrl(readerInstance);
487-
final String writerClusterUrl = ConnectionStringHelper.getWrapperClusterEndpointUrl();
488-
final String readerClusterUrl = ConnectionStringHelper.getWrapperReaderClusterUrl();
489-
490-
for (String plugin : PLUGINS) {
491-
// Connect via writer instance endpoint.
492-
results.add(Arguments.of(plugin, writerInstanceUrl));
493-
// Connect via reader instance endpoint.
494-
results.add(Arguments.of(plugin, readerInstanceUrl));
495-
// Connect via writer cluster endpoint.
496-
results.add(Arguments.of(plugin, writerClusterUrl));
497-
// Connect via reader cluster endpoint.
498-
results.add(Arguments.of(plugin, readerClusterUrl));
499-
}
500-
return results.stream();
501-
}
502494
}

0 commit comments

Comments
 (0)