Skip to content

Commit a22fe6c

Browse files
authored
chore: update performance test to use failover mode (#659)
1 parent 71d7240 commit a22fe6c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.junit.jupiter.api.TestTemplate;
5555
import org.junit.jupiter.api.extension.ExtendWith;
5656
import org.junit.jupiter.params.provider.Arguments;
57+
import software.amazon.jdbc.plugin.failover.FailoverConnectionPlugin;
5758
import software.amazon.jdbc.util.StringUtils;
5859

5960
@TestMethodOrder(MethodOrderer.MethodName.class)
@@ -163,7 +164,7 @@ private void execute_FailureDetectionTime_EnhancedMonitoringEnabled(
163164
PLUGINS.set(props, "efm");
164165

165166
final PerfStatMonitoring data = new PerfStatMonitoring();
166-
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, false, data);
167+
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, data);
167168
data.paramDetectionTime = detectionTime;
168169
data.paramDetectionInterval = detectionInterval;
169170
data.paramDetectionCount = detectionCount;
@@ -224,9 +225,10 @@ private void execute_FailureDetectionTime_FailoverAndEnhancedMonitoringEnabled(
224225
.getInfo()
225226
.getProxyDatabaseInfo()
226227
.getInstanceEndpointSuffix());
228+
FailoverConnectionPlugin.FAILOVER_MODE.set(props, "strict-reader");
227229

228230
final PerfStatMonitoring data = new PerfStatMonitoring();
229-
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, true, data);
231+
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, data);
230232
data.paramDetectionTime = detectionTime;
231233
data.paramDetectionInterval = detectionInterval;
232234
data.paramDetectionCount = detectionCount;
@@ -279,9 +281,10 @@ private void execute_FailoverTime_SocketTimeout(int socketTimeout, int sleepDela
279281
.getProxyDatabaseInfo()
280282
.getInstanceEndpointSuffix());
281283
props.setProperty("failoverTimeoutMs", Integer.toString(PERF_FAILOVER_TIMEOUT_MS));
284+
FailoverConnectionPlugin.FAILOVER_MODE.set(props, "strict-reader");
282285

283286
final PerfStatSocketTimeout data = new PerfStatSocketTimeout();
284-
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, true, data);
287+
doMeasurePerformance(sleepDelayMillis, REPEAT_TIMES, props, data);
285288
data.paramSocketTimeout = socketTimeout;
286289
failoverWithSocketTimeoutPerfDataList.add(data);
287290
}
@@ -290,7 +293,6 @@ private void doMeasurePerformance(
290293
int sleepDelayMillis,
291294
int repeatTimes,
292295
Properties props,
293-
boolean openReadOnlyConnection,
294296
PerfStatBase data)
295297
throws SQLException {
296298

@@ -324,7 +326,6 @@ private void doMeasurePerformance(
324326
try (final Connection conn = openConnectionWithRetry(props);
325327
final Statement statement = conn.createStatement()) {
326328

327-
conn.setReadOnly(openReadOnlyConnection);
328329
thread.start();
329330

330331
// Execute long query

0 commit comments

Comments
 (0)