Skip to content
Merged
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
7 changes: 3 additions & 4 deletions .github/workflows/run-metrics-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: Run Metrics Latest

on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "8 0 * * *" # Runs daily at 8am UTC (1am PST)

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
all-integration-tests-latest:
run-metrics-with-latest:
name: Run Metrics with latest engine version
runs-on: ubuntu-latest
strategy:
Expand Down
130 changes: 130 additions & 0 deletions wrapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ dependencies {
testImplementation("de.vandermeer:asciitable:0.3.2")
testImplementation("org.hibernate:hibernate-core:5.6.15.Final") // the latest version compatible with Java 8
testImplementation("jakarta.persistence:jakarta.persistence-api:2.2.3")
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.2")
}

repositories {
Expand Down Expand Up @@ -880,3 +881,132 @@ tasks.register<Test>("debug-autoscaling-only") {
systemProperty("test-no-openjdk22", "true")
}
}

// Metrics

tasks.register<Test>("test-all-metrics") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("test-no-docker", "true")
systemProperty("test-no-performance", "true")
systemProperty("test-no-mariadb-engine", "true")
systemProperty("test-no-mariadb-driver", "true")
systemProperty("test-no-graalvm", "true")
systemProperty("test-no-openjdk11", "true")
systemProperty("test-no-openjdk17", "true")
systemProperty("test-no-openjdk22", "true")
systemProperty("test-no-failover", "true")
systemProperty("test-no-secrets-manager", "true")
systemProperty("test-no-hikari", "true")
systemProperty("test-no-instances-1", "true")
systemProperty("test-no-instances-2", "true")
systemProperty("test-no-instances-5", "true")
systemProperty("test-no-bg", "true")
systemProperty("test-metrics-only", "true")
}
}

tasks.register<Test>("test-metrics-mysql-aurora") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("test-no-docker", "true")
systemProperty("test-no-performance", "true")
systemProperty("test-no-mariadb-engine", "true")
systemProperty("test-no-mariadb-driver", "true")
systemProperty("test-no-graalvm", "true")
systemProperty("test-no-openjdk11", "true")
systemProperty("test-no-openjdk17", "true")
systemProperty("test-no-openjdk22", "true")
systemProperty("test-no-failover", "true")
systemProperty("test-no-secrets-manager", "true")
systemProperty("test-no-hikari", "true")
systemProperty("test-no-instances-1", "true")
systemProperty("test-no-instances-2", "true")
systemProperty("test-no-instances-3", "true")
systemProperty("test-no-bg", "true")
systemProperty("test-metrics-only", "true")

systemProperty("test-no-multi-az-cluster", "true")
systemProperty("test-no-pg-engine", "true")
}
}

tasks.register<Test>("test-metrics-mysql-multi-az") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("test-no-docker", "true")
systemProperty("test-no-performance", "true")
systemProperty("test-no-mariadb-engine", "true")
systemProperty("test-no-mariadb-driver", "true")
systemProperty("test-no-graalvm", "true")
systemProperty("test-no-openjdk11", "true")
systemProperty("test-no-openjdk17", "true")
systemProperty("test-no-openjdk22", "true")
systemProperty("test-no-failover", "true")
systemProperty("test-no-secrets-manager", "true")
systemProperty("test-no-hikari", "true")
systemProperty("test-no-instances-1", "true")
systemProperty("test-no-instances-2", "true")
systemProperty("test-no-instances-5", "true")
systemProperty("test-no-bg", "true")
systemProperty("test-metrics-only", "true")

systemProperty("test-no-aurora", "true")
systemProperty("test-no-pg-engine", "true")
}
}

tasks.register<Test>("test-metrics-pg-aurora") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("test-no-docker", "true")
systemProperty("test-no-performance", "true")
systemProperty("test-no-mariadb-engine", "true")
systemProperty("test-no-mariadb-driver", "true")
systemProperty("test-no-graalvm", "true")
systemProperty("test-no-openjdk11", "true")
systemProperty("test-no-openjdk17", "true")
systemProperty("test-no-openjdk22", "true")
systemProperty("test-no-failover", "true")
systemProperty("test-no-secrets-manager", "true")
systemProperty("test-no-hikari", "true")
systemProperty("test-no-instances-1", "true")
systemProperty("test-no-instances-2", "true")
systemProperty("test-no-instances-3", "true")
systemProperty("test-no-bg", "true")
systemProperty("test-metrics-only", "true")

systemProperty("test-no-multi-az-cluster", "true")
systemProperty("test-no-mysql-engine", "true")
}
}

tasks.register<Test>("test-metrics-pg-multi-az") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.runTests")
doFirst {
systemProperty("test-no-docker", "true")
systemProperty("test-no-performance", "true")
systemProperty("test-no-mariadb-engine", "true")
systemProperty("test-no-mariadb-driver", "true")
systemProperty("test-no-graalvm", "true")
systemProperty("test-no-openjdk11", "true")
systemProperty("test-no-openjdk17", "true")
systemProperty("test-no-openjdk22", "true")
systemProperty("test-no-failover", "true")
systemProperty("test-no-secrets-manager", "true")
systemProperty("test-no-hikari", "true")
systemProperty("test-no-instances-1", "true")
systemProperty("test-no-instances-2", "true")
systemProperty("test-no-instances-5", "true")
systemProperty("test-no-bg", "true")
systemProperty("test-metrics-only", "true")

systemProperty("test-no-aurora", "true")
systemProperty("test-no-mysql-engine", "true")
}
}
3 changes: 2 additions & 1 deletion wrapper/src/main/java/software/amazon/jdbc/HostSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public Set<String> asAliases() {
}

public String toString() {
return String.format("HostSpec[host=%s, port=%d, %s, %s, weight=%d, %s]",
return String.format("HostSpec@%s [host=%s, port=%d, %s, %s, weight=%d, %s]",
Integer.toHexString(System.identityHashCode(this)),
this.host, this.port, this.role, this.availability, this.weight, this.lastUpdateTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void monitor() {
try {
LOGGER.finest(() -> Messages.get(
"ClusterTopologyMonitorImpl.startMonitoringThread",
new Object[]{this.initialHostSpec.getHost()}));
new Object[]{this.clusterId, this.initialHostSpec.getHost()}));

while (!this.stop.get() && !Thread.currentThread().isInterrupted()) {
this.lastActivityTimestampNanos.set(System.nanoTime());
Expand Down Expand Up @@ -311,8 +311,11 @@ public void monitor() {
for (HostSpec hostSpec : hosts) {
this.submittedNodes.computeIfAbsent(hostSpec.getHost(),
(key) -> {
this.nodeExecutorService.submit(
this.getNodeMonitoringWorker(hostSpec, this.writerHostSpec.get()));
final ExecutorService nodeExecutorServiceCopy = this.nodeExecutorService;
if (nodeExecutorServiceCopy != null) {
this.nodeExecutorService.submit(
this.getNodeMonitoringWorker(hostSpec, this.writerHostSpec.get()));
}
return true;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ NodeResponseTimeMonitor.exceptionDuringMonitoringStop=Stopping thread after unha
NodeResponseTimeMonitor.openingConnection=Opening a Response time connection to ''{0}''.
NodeResponseTimeMonitor.openedConnection=Opened Response time connection: {0}.

ClusterTopologyMonitorImpl.startMonitoringThread=Start cluster topology monitoring thread for ''{0}''.
ClusterTopologyMonitorImpl.startMonitoringThread=[clusterId: ''{0}''] Start cluster topology monitoring thread for ''{1}''.
ClusterTopologyMonitorImpl.stopMonitoringThread=Stop cluster topology monitoring thread for ''{0}''.
ClusterTopologyMonitorImpl.exceptionDuringMonitoringStop=Stopping cluster topology monitoring after unhandled exception was thrown in monitoring thread for node ''{0}''.
ClusterTopologyMonitorImpl.invalidQuery=An error occurred while attempting to obtain the topology because the topology query was invalid. Please ensure you are connecting to an Aurora or RDS Db cluster.
Expand Down
1 change: 1 addition & 0 deletions wrapper/src/test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ dependencies {
testImplementation("de.vandermeer:asciitable:0.3.2")
testImplementation("org.hibernate:hibernate-core:5.6.15.Final") // the latest version compatible with Java 8
testImplementation("jakarta.persistence:jakarta.persistence-api:2.2.3")
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.2")
}

tasks.withType<Test> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ public enum TestEnvironmentFeatures {
RUN_AUTOSCALING_TESTS_ONLY,
TELEMETRY_TRACES_ENABLED,
TELEMETRY_METRICS_ENABLED,
BLUE_GREEN_DEPLOYMENT
BLUE_GREEN_DEPLOYMENT,
RUN_DB_METRICS_ONLY
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private static void clearCaches() {
Driver.resetConnectionInitFunc();
}

private static void checkClusterHealth(final boolean makeSureFirstInstanceWriter)
public static void checkClusterHealth(final boolean makeSureFirstInstanceWriter)
throws InterruptedException, SQLException {

final TestEnvironmentInfo testInfo = TestEnvironment.getCurrent().getInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import integration.container.TestEnvironment;
import integration.container.aurora.TestAuroraHostListProvider;
import integration.container.aurora.TestPluginServiceImpl;
import integration.container.condition.DisableOnTestFeature;
import integration.container.condition.EnableOnTestFeature;
import integration.util.AuroraTestUtility;
import java.io.File;
Expand Down Expand Up @@ -76,6 +77,7 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.FAILOVER_SUPPORTED
})
@DisableOnTestFeature(TestEnvironmentFeatures.RUN_DB_METRICS_ONLY)
@Tag("advanced")
@Order(1)
public class AdvancedPerformanceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import integration.container.ConnectionStringHelper;
import integration.container.TestDriverProvider;
import integration.container.TestEnvironment;
import integration.container.condition.DisableOnTestFeature;
import integration.container.condition.EnableOnDatabaseEngineDeployment;
import integration.container.condition.EnableOnNumOfInstances;
import integration.container.condition.EnableOnTestFeature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(3)
// MariaDb driver has no configuration parameters to force using 'mysql_clear_password'
// authentication that is essential for IAM. A proper user name and IAM token are passed to MariaDb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
@DisableOnTestFeature({
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY})
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(4)
public class BasicConnectivityTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import integration.container.TestDriver;
import integration.container.TestDriverProvider;
import integration.container.TestEnvironment;
import integration.container.condition.DisableOnTestFeature;
import integration.container.condition.EnableOnDatabaseEngine;
import integration.container.condition.EnableOnDatabaseEngineDeployment;
import integration.container.condition.EnableOnTestFeature;
Expand Down Expand Up @@ -89,6 +90,7 @@

@TestMethodOrder(MethodOrderer.MethodName.class)
@EnableOnTestFeature(TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT)
@DisableOnTestFeature(TestEnvironmentFeatures.RUN_DB_METRICS_ONLY)
@EnableOnDatabaseEngineDeployment({DatabaseEngineDeployment.RDS_MULTI_AZ_INSTANCE, DatabaseEngineDeployment.AURORA})
@EnableOnDatabaseEngine({DatabaseEngine.MYSQL, DatabaseEngine.PG})
@Order(18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@EnableOnNumOfInstances(min = 3)
@MakeSureFirstInstanceWriter
@Order(16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@MakeSureFirstInstanceWriter
@Order(5)
public class DataCachePluginTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(6)
public class DataSourceTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(7)
public class DriverConfigurationProfileTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@EnableOnNumOfInstances(min = 2)
@MakeSureFirstInstanceWriter
@Order(15)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@MakeSureFirstInstanceWriter
@Order(14)
public class FailoverTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@MakeSureFirstInstanceWriter
@Order(8)
public class HikariTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(9)
public class LogQueryPluginTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import integration.container.ProxyHelper;
import integration.container.TestDriverProvider;
import integration.container.TestEnvironment;
import integration.container.condition.DisableOnTestFeature;
import integration.container.condition.EnableOnTestFeature;
import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -76,6 +77,7 @@
TestEnvironmentFeatures.NETWORK_OUTAGES_ENABLED,
TestEnvironmentFeatures.FAILOVER_SUPPORTED
})
@DisableOnTestFeature(TestEnvironmentFeatures.RUN_DB_METRICS_ONLY)
@Order(10)
public class PerformanceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
TestEnvironmentFeatures.PERFORMANCE,
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT})
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
@Order(2)
public class RdsConnectivityTests {

Expand Down
Loading
Loading