Skip to content

Commit 73934b9

Browse files
authored
Add detailed logs to TestEnvironmentConfig cleanup (#342)
1 parent 4f94f77 commit 73934b9

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/integration/container/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from __future__ import annotations
1616

17+
import atexit
1718
from typing import TYPE_CHECKING
1819

1920
from aws_advanced_python_wrapper.connection_provider import \
@@ -136,3 +137,10 @@ def pytest_sessionstart(session):
136137
def pytest_sessionfinish(session, exitstatus):
137138
# Enable all connectivity in case any helper threads are still trying to execute against a disabled host
138139
ProxyHelper.enable_all_connectivity()
140+
141+
142+
def log_exit():
143+
print("Python program is exiting...")
144+
145+
146+
atexit.register(log_exit)

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,12 @@ public void debugTests(String folderName) throws IOException, InterruptedExcepti
664664

665665
@Override
666666
public void close() {
667+
LOGGER.info("[TestEnvironmentConfig] close() was called");
667668
if (this.databaseContainers != null) {
669+
LOGGER.info("[TestEnvironmentConfig] this.databaseContainers was not null");
668670
for (GenericContainer<?> container : this.databaseContainers) {
669671
try {
672+
LOGGER.info("[TestEnvironmentConfig] stopping container...");
670673
container.stop();
671674
} catch (Exception ex) {
672675
// ignore
@@ -676,12 +679,15 @@ public void close() {
676679
}
677680

678681
if (this.testContainer != null) {
682+
LOGGER.info("[TestEnvironmentConfig] stopping test container...");
679683
this.testContainer.stop();
680684
this.testContainer = null;
681685
}
682686

683687
if (this.proxyContainers != null) {
688+
LOGGER.info("[TestEnvironmentConfig] this.proxyContainers not null");
684689
for (ToxiproxyContainer proxyContainer : this.proxyContainers) {
690+
LOGGER.info("[TestEnvironmentConfig] stopping proxy container...");
685691
proxyContainer.stop();
686692
}
687693
this.proxyContainers = null;
@@ -695,6 +701,7 @@ public void close() {
695701
case RDS:
696702
throw new NotImplementedException(this.info.getRequest().getDatabaseEngineDeployment().toString());
697703
default:
704+
LOGGER.info("[TestEnvironmentConfig] default switch branch was hit inside close()");
698705
// do nothing
699706
}
700707
}
@@ -709,14 +716,20 @@ public String getPrimaryInfo() {
709716
}
710717

711718
private void deleteDbCluster() {
719+
LOGGER.info("[TestEnvironmentConfig] deleteDbCluster() was called");
720+
LOGGER.info("[TestEnvironmentConfig] reuseDbCluster value: " + this.reuseDbCluster);
712721
if (!this.reuseDbCluster && !StringUtils.isNullOrEmpty(this.runnerIP)) {
722+
LOGGER.info("[TestEnvironmentConfig] deauthorizing IP...");
713723
rdsUtil.ec2DeauthorizesIP(runnerIP);
714724
}
715725

716726
if (!this.reuseDbCluster) {
727+
LOGGER.info("[TestEnvironmentConfig] deleting cluster...");
717728
LOGGER.finest("Deleting cluster " + this.clusterName + ".cluster-" + this.clusterDomain);
718729
rdsUtil.deleteCluster(this.clusterName);
719730
LOGGER.finest("Deleted cluster " + this.clusterName + ".cluster-" + this.clusterDomain);
731+
} else {
732+
LOGGER.info("[TestEnvironmentConfig] The reuseDbCluster branch was hit in deleteDbCluster");
720733
}
721734
}
722735
}

0 commit comments

Comments
 (0)