Skip to content

Commit 0286913

Browse files
committed
fix: failing integration tests due to not waiting for TAZ cluster to fully failover
1 parent a29a5f0 commit 0286913

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.github/workflows/integration_tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ jobs:
5858
5959
- name: 'Run Integration Tests'
6060
run: |
61-
./gradlew --no-parallel --no-daemon test-python-${{ matrix.python-version }} --info
61+
./gradlew --no-parallel --no-daemon test-mysql-multi-az --info
6262
env:
6363
RDS_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }}
6464
RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
6565
AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }}
6666
AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }}
6767
AWS_SESSION_TOKEN: ${{ env.TEMP_AWS_SESSION_TOKEN }}
68+
FILTER: test_pooled_connection__failover
6869

6970
- name: 'Archive results'
7071
if: always()

tests/integration/container/utils/rds_test_utility.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def failover_cluster_and_wait_until_writer_changed(
156156
sleep(1)
157157
cluster_address = socket.gethostbyname(cluster_endpoint)
158158

159+
self.make_sure_instances_up(self.get_instance_ids())
159160
self.logger.debug("Testing.FinishedFailover", initial_writer_id, str((perf_counter_ns() - start) / 1_000_000))
160161

161162
def failover_cluster(self, cluster_id: Optional[str] = None) -> None:

tests/integration/host/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ tasks.register<Test>("test-mysql-multi-az") {
158158
systemProperty("exclude-aurora", "true")
159159
systemProperty("exclude-pg-driver", "true")
160160
systemProperty("exclude-pg-engine", "true")
161+
systemProperty("exclude-python-311", "true")
161162
}
162163
}
163164

@@ -331,5 +332,6 @@ tasks.register<Test>("debug-mysql-multi-az") {
331332
systemProperty("exclude-performance", "true")
332333
systemProperty("exclude-pg-driver", "true")
333334
systemProperty("exclude-pg-engine", "true")
335+
systemProperty("exclude-python-311", "true")
334336
}
335337
}

tests/integration/host/src/test/java/integration/host/TestEnvironment.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,22 @@ private TestEnvironment(TestEnvironmentRequest request) {
102102
}
103103

104104
public static TestEnvironment build(TestEnvironmentRequest request) throws IOException {
105+
DatabaseEngineDeployment deployment = request.getDatabaseEngineDeployment();
106+
if (deployment == DatabaseEngineDeployment.AURORA
107+
|| deployment == DatabaseEngineDeployment.RDS
108+
|| deployment == DatabaseEngineDeployment.RDS_MULTI_AZ) {
109+
// These environment require creating external database cluster that should be publicly available.
110+
// Corresponding AWS Security Groups should be configured and the test task runner IP address
111+
// should be whitelisted.
112+
ipAddressUsageRefCount.incrementAndGet();
113+
}
114+
105115
LOGGER.finest("Building test env: " + request.getEnvPreCreateIndex());
106116
preCreateEnvironment(request.getEnvPreCreateIndex());
107117

108118
TestEnvironment env;
109119

110-
switch (request.getDatabaseEngineDeployment()) {
120+
switch (deployment) {
111121
case DOCKER:
112122
env = new TestEnvironment(request);
113123
initDatabaseParams(env);
@@ -894,7 +904,11 @@ public void close() throws Exception {
894904

895905
private void deleteDbCluster() {
896906
if (!this.reuseAuroraDbCluster && !StringUtils.isNullOrEmpty(this.runnerIP)) {
897-
auroraUtil.ec2DeauthorizesIP(runnerIP);
907+
if (ipAddressUsageRefCount.decrementAndGet() == 0) {
908+
// Another test environments are still in use of test task runner IP address.
909+
// The last execute tst environment will do the cleanup.
910+
auroraUtil.ec2DeauthorizesIP(runnerIP);
911+
}
898912
}
899913

900914
if (!this.reuseAuroraDbCluster) {

0 commit comments

Comments
 (0)