summaryrefslogtreecommitdiffstats
path: root/cps-ri/src
diff options
context:
space:
mode:
authorToine Siebelink <toine.siebelink@est.tech>2021-01-04 14:21:44 +0000
committerGerrit Code Review <gerrit@onap.org>2021-01-04 14:21:44 +0000
commitb41740d115b403e1790ec854c2aacf8b114ea6d0 (patch)
tree1996fc5c0f1137eb3d21a86949afb2fa7ce8af93 /cps-ri/src
parente3b0dc3e73843b3f9a15123911c131dae390690d (diff)
parent191b09ce5d3efcb96cc7bf8468ab62626ad62a34 (diff)
Merge "Fix test container remain in docker after tests completion. IMPORTANT."
Diffstat (limited to 'cps-ri/src')
-rw-r--r--cps-ri/src/test/java/org/onap/cps/DatabaseTestContainer.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/cps-ri/src/test/java/org/onap/cps/DatabaseTestContainer.java b/cps-ri/src/test/java/org/onap/cps/DatabaseTestContainer.java
index 759cc95319..a621b2ca4d 100644
--- a/cps-ri/src/test/java/org/onap/cps/DatabaseTestContainer.java
+++ b/cps-ri/src/test/java/org/onap/cps/DatabaseTestContainer.java
@@ -44,6 +44,7 @@ public class DatabaseTestContainer extends PostgreSQLContainer<DatabaseTestConta
public static DatabaseTestContainer getInstance() {
if (databaseTestContainer == null) {
databaseTestContainer = new DatabaseTestContainer();
+ Runtime.getRuntime().addShutdownHook(new Thread(databaseTestContainer::terminate));
}
return databaseTestContainer;
}
@@ -58,7 +59,10 @@ public class DatabaseTestContainer extends PostgreSQLContainer<DatabaseTestConta
@Override
public void stop() {
- //do nothing, JVM handles shut down
+ // do nothing on test completion, image removal will be performed via terminate() on JVM shutdown
}
+ private void terminate() {
+ super.stop();
+ }
}