Skip to content

Commit 2508e7f

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

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

tests/integration/container/utils/rds_test_utility.py

+1
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/src/test/java/integration/host/TestEnvironment.java

+16-2
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)