diff --git a/build.gradle.kts b/build.gradle.kts index feaaf0f70..6ff5f9256 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -136,7 +136,7 @@ tasks.shadowJar { exclude("instrumentation/**") exclude("demo/**") exclude("documentation/**") - exclude("customplugins/**"); + exclude("customplugins/**") includeEmptyDirs = false } @@ -447,7 +447,10 @@ tasks.register("in-container-aurora") { } tasks.register("in-container-aurora-performance") { - filter.includeTestsMatching("testsuite.integration.container.AuroraMysqlPerformanceIntegrationTest") + filter.includeTestsMatching( + "testsuite.integration.container.AuroraMysqlPerformanceIntegrationTest") + filter.includeTestsMatching( + "testsuite.integration.container.AuroraMysqlPerformanceForEfm2IntegrationTest") } // Run all tests excluding integration tests diff --git a/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceForEfm2IntegrationTest.java b/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceForEfm2IntegrationTest.java new file mode 100644 index 000000000..b8b21d3cd --- /dev/null +++ b/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceForEfm2IntegrationTest.java @@ -0,0 +1,72 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2.0 + * (GPLv2), as published by the Free Software Foundation, with the + * following additional permissions: + * + * This program is distributed with certain software that is licensed + * under separate terms, as designated in a particular file or component + * or in the license documentation. Without limiting your rights under + * the GPLv2, the authors of this program hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have included with the program. + * + * Without limiting the foregoing grant of rights under the GPLv2 and + * additional permission as to separately licensed software, this + * program is also subject to the Universal FOSS Exception, version 1.0, + * a copy of which can be found along with its FAQ at + * http://oss.oracle.com/licenses/universal-foss-exception. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License, version 2.0, for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * http://www.gnu.org/licenses/gpl-2.0.html. + */ + +package testsuite.integration.container; + +import com.mysql.cj.conf.PropertyKey; +import com.mysql.cj.jdbc.ha.plugins.failover.FailoverConnectionPluginFactory; +import java.io.IOException; +import java.sql.SQLException; +import java.util.Properties; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; + +public class AuroraMysqlPerformanceForEfm2IntegrationTest extends AuroraMysqlPerformanceIntegrationTest { + + @BeforeAll + public static void setUp() throws IOException, SQLException { + AuroraMysqlPerformanceIntegrationTest.setUp(); + } + + @AfterAll + public static void cleanUp() throws IOException { + doWritePerfDataToFile("./build/reports/tests/FailureDetectionResults_EnhancedMonitoring_efm2.xlsx", enhancedFailureMonitoringPerfDataList); + doWritePerfDataToFile("./build/reports/tests/FailoverPerformanceResults_EnhancedMonitoring_efm2.xlsx", failoverWithEfmPerfDataList); + doWritePerfDataToFile("./build/reports/tests/FailoverPerformanceResults_SocketTimeout_efm2.xlsx", failoverWithSocketTimeoutPerfDataList); + } + + @Override + protected Properties initDefaultPropsNoTimeouts() { + final Properties props = new Properties(); + props.setProperty(PropertyKey.USER.getKeyName(), TEST_USERNAME); + props.setProperty(PropertyKey.PASSWORD.getKeyName(), TEST_PASSWORD); + props.setProperty(PropertyKey.tcpKeepAlive.getKeyName(), Boolean.FALSE.toString()); + props.setProperty(PropertyKey.connectionPluginFactories.getKeyName(), + FailoverConnectionPluginFactory.class.getName() + + "," + + com.mysql.cj.jdbc.ha.plugins.efm2.NodeMonitoringConnectionPluginFactory.class.getName()); + + // Uncomment the following line to ease debugging + props.setProperty(PropertyKey.logger.getKeyName(), "com.mysql.cj.log.StandardLogger"); + + return props; + } +} diff --git a/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceIntegrationTest.java b/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceIntegrationTest.java index b6a478207..14159e209 100644 --- a/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceIntegrationTest.java +++ b/src/test/java/testsuite/integration/container/AuroraMysqlPerformanceIntegrationTest.java @@ -60,11 +60,11 @@ public class AuroraMysqlPerformanceIntegrationTest extends AuroraMysqlIntegrationBaseTest { - private static final int REPEAT_TIMES = 5; - private static final int FAILOVER_TIMEOUT_MS = 40000; - private static final List enhancedFailureMonitoringPerfDataList = new ArrayList<>(); - private static final List failoverWithEfmPerfDataList = new ArrayList<>(); - private static final List failoverWithSocketTimeoutPerfDataList = new ArrayList<>(); + protected static final int REPEAT_TIMES = 5; + protected static final int FAILOVER_TIMEOUT_MS = 40000; + protected static final List enhancedFailureMonitoringPerfDataList = new ArrayList<>(); + protected static final List failoverWithEfmPerfDataList = new ArrayList<>(); + protected static final List failoverWithSocketTimeoutPerfDataList = new ArrayList<>(); @BeforeAll public static void setUp() throws IOException, SQLException { @@ -78,7 +78,7 @@ public static void cleanUp() throws IOException { doWritePerfDataToFile("./build/reports/tests/FailoverPerformanceResults_SocketTimeout.xlsx", failoverWithSocketTimeoutPerfDataList); } - private static void doWritePerfDataToFile(String fileName, List dataList) throws IOException { + protected static void doWritePerfDataToFile(String fileName, List dataList) throws IOException { if (dataList.isEmpty()) { return; }