From 0f5d2c88862df4cc9a46838a0c17331e8b8fd54f Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Wed, 25 Nov 2026 04:49:14 -0600 Subject: [PATCH] test: run the EKS auto mode classes nightly and wait for a PgBouncer login (#9423) EksAutoModeBlockStorageDockerIntegrationTest and EksAutoModeNlbDockerIntegrationTest each start a k3s node, so they become DockerNightlyIntegrationTest classes behind the nightly.checks.enabled guard, and a change under services/eks/ still runs them through the nightly selection. RdsPgBouncerDockerNightlyIntegrationTest waited for the pooler's port with a socket probe, which Docker publishes before PgBouncer listens, so the wait now completes a JDBC login and SELECT 1 for up to 30 seconds. --- ...kStorageDockerNightlyIntegrationTest.java} | 8 +++++--- ...oModeNlbDockerNightlyIntegrationTest.java} | 8 +++++--- ...PgBouncerDockerNightlyIntegrationTest.java | 19 ++++++++++--------- 3 files changed, 20 insertions(+), 15 deletions(-) rename src/test/java/io/floci/aws/services/eks/{EksAutoModeBlockStorageDockerIntegrationTest.java => EksAutoModeBlockStorageDockerNightlyIntegrationTest.java} (94%) rename src/test/java/io/floci/aws/services/eks/{EksAutoModeNlbDockerIntegrationTest.java => EksAutoModeNlbDockerNightlyIntegrationTest.java} (96%) diff --git a/src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerNightlyIntegrationTest.java similarity index 94% rename from src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerIntegrationTest.java rename to src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerNightlyIntegrationTest.java index a015f93a57..249c02674c 100644 --- a/src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/eks/EksAutoModeBlockStorageDockerNightlyIntegrationTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import java.time.Duration; import java.util.UUID; @@ -31,9 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; */ @QuarkusTest @TestProfile(RdsMockProfile.class) -class EksAutoModeBlockStorageDockerIntegrationTest { +@EnabledIfSystemProperty(named = "nightly.checks.enabled", matches = "true") +class EksAutoModeBlockStorageDockerNightlyIntegrationTest { - private static final Logger LOG = Logger.getLogger(EksAutoModeBlockStorageDockerIntegrationTest.class); + private static final Logger LOG = Logger.getLogger(EksAutoModeBlockStorageDockerNightlyIntegrationTest.class); private static final String ACCOUNT = "000000000000"; private static final String PROVISIONER = "floci-auto-mode-ebs-provisioner"; @@ -49,7 +51,7 @@ class EksAutoModeBlockStorageDockerIntegrationTest { void requireDocker() { boolean dockerAvailable = DockerAvailability.answers(dockerClient); if (!dockerAvailable) { - LOG.warn("Docker daemon is not available; skipping EksAutoModeBlockStorageDockerIntegrationTest"); + LOG.warn("Docker daemon is not available; skipping EksAutoModeBlockStorageDockerNightlyIntegrationTest"); } Assumptions.assumeTrue(dockerAvailable, "Docker daemon must be available for the Auto Mode block storage test"); } diff --git a/src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerNightlyIntegrationTest.java similarity index 96% rename from src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerIntegrationTest.java rename to src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerNightlyIntegrationTest.java index a957a9b084..e580310f9f 100644 --- a/src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/eks/EksAutoModeNlbDockerNightlyIntegrationTest.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import java.time.Duration; import java.util.List; @@ -41,9 +42,10 @@ import static org.junit.jupiter.api.Assertions.assertThrows; */ @QuarkusTest @TestProfile(RdsMockProfile.class) -class EksAutoModeNlbDockerIntegrationTest { +@EnabledIfSystemProperty(named = "nightly.checks.enabled", matches = "true") +class EksAutoModeNlbDockerNightlyIntegrationTest { - private static final Logger LOG = Logger.getLogger(EksAutoModeNlbDockerIntegrationTest.class); + private static final Logger LOG = Logger.getLogger(EksAutoModeNlbDockerNightlyIntegrationTest.class); private static final String ACCOUNT = "000000000000"; private static final String REGION = "us-east-1"; @@ -68,7 +70,7 @@ class EksAutoModeNlbDockerIntegrationTest { void requireDocker() { boolean dockerAvailable = DockerAvailability.answers(dockerClient); if (!dockerAvailable) { - LOG.warn("Docker daemon is not available; skipping EksAutoModeNlbDockerIntegrationTest"); + LOG.warn("Docker daemon is not available; skipping EksAutoModeNlbDockerNightlyIntegrationTest"); } Assumptions.assumeTrue(dockerAvailable, "Docker daemon must be available for the Auto Mode NLB test"); } diff --git a/src/test/java/io/floci/aws/services/rds/proxy/RdsPgBouncerDockerNightlyIntegrationTest.java b/src/test/java/io/floci/aws/services/rds/proxy/RdsPgBouncerDockerNightlyIntegrationTest.java index c87c4139a1..487cf78f7a 100644 --- a/src/test/java/io/floci/aws/services/rds/proxy/RdsPgBouncerDockerNightlyIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/rds/proxy/RdsPgBouncerDockerNightlyIntegrationTest.java @@ -17,12 +17,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import java.io.Closeable; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.time.Duration; import java.util.HashSet; @@ -106,7 +104,8 @@ class RdsPgBouncerDockerNightlyIntegrationTest { pooler = lifecycle.createAndStart(spec); poolerLogs = logs.attachConsoleOnly(pooler.containerId(), "pgbouncer:" + suffix); EndpointInfo endpoint = pooler.getEndpoint(5432); - await().atMost(Duration.ofSeconds(10)).until(() -> listening(endpoint)); + // Docker publishes the port before PgBouncer listens, so only a completed login means it is ready. + await().atMost(Duration.ofSeconds(30)).until(() -> acceptsLogin(endpoint)); // server_lifetime=0 closes a pooled server after each client; distinct backend PIDs // prove that every iteration authenticates again rather than reusing a warm session. @@ -145,11 +144,13 @@ class RdsPgBouncerDockerNightlyIntegrationTest { return "jdbc:postgresql://" + host + ":" + port + "/appdb"; } - private static boolean listening(EndpointInfo endpoint) { - try (Socket socket = new Socket()) { - socket.connect(new InetSocketAddress(endpoint.host(), endpoint.port()), 200); - return true; - } catch (IOException e) { + private static boolean acceptsLogin(EndpointInfo endpoint) { + try (Connection connection = DriverManager.getConnection(jdbcUrl(endpoint.host(), endpoint.port()), + credentials("app_user", "Application123!")); + Statement statement = connection.createStatement()) { + return statement.execute("SELECT 1"); + } catch (SQLException expected) { + // Refused or reset while PgBouncer starts, or a login it cannot pass on yet: poll again. return false; } }