Skip to content

Commit

Permalink
fix: failing integration tests due to not waiting for TAZ cluster to …
Browse files Browse the repository at this point in the history
…fully failover
  • Loading branch information
karenc-bq committed Mar 28, 2024
1 parent a29a5f0 commit 2508e7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/integration/container/utils/rds_test_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def failover_cluster_and_wait_until_writer_changed(
sleep(1)
cluster_address = socket.gethostbyname(cluster_endpoint)

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

def failover_cluster(self, cluster_id: Optional[str] = None) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,22 @@ private TestEnvironment(TestEnvironmentRequest request) {
}

public static TestEnvironment build(TestEnvironmentRequest request) throws IOException {
DatabaseEngineDeployment deployment = request.getDatabaseEngineDeployment();
if (deployment == DatabaseEngineDeployment.AURORA
|| deployment == DatabaseEngineDeployment.RDS
|| deployment == DatabaseEngineDeployment.RDS_MULTI_AZ) {
// These environment require creating external database cluster that should be publicly available.
// Corresponding AWS Security Groups should be configured and the test task runner IP address
// should be whitelisted.
ipAddressUsageRefCount.incrementAndGet();
}

LOGGER.finest("Building test env: " + request.getEnvPreCreateIndex());
preCreateEnvironment(request.getEnvPreCreateIndex());

TestEnvironment env;

switch (request.getDatabaseEngineDeployment()) {
switch (deployment) {
case DOCKER:
env = new TestEnvironment(request);
initDatabaseParams(env);
Expand Down Expand Up @@ -894,7 +904,11 @@ public void close() throws Exception {

private void deleteDbCluster() {
if (!this.reuseAuroraDbCluster && !StringUtils.isNullOrEmpty(this.runnerIP)) {
auroraUtil.ec2DeauthorizesIP(runnerIP);
if (ipAddressUsageRefCount.decrementAndGet() == 0) {
// Another test environments are still in use of test task runner IP address.
// The last execute tst environment will do the cleanup.
auroraUtil.ec2DeauthorizesIP(runnerIP);
}
}

if (!this.reuseAuroraDbCluster) {
Expand Down

0 comments on commit 2508e7f

Please sign in to comment.