Skip to content

Commit c4ab741

Browse files
committed
document teardownIfSuccess method
1 parent 0cc5950 commit c4ab741

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

operator-framework/src/test/java/com/github/containersolutions/operator/IntegrationTestSupport.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ public void cleanup() {
8585
log.info("Cleaned up namespace " + TEST_NAMESPACE);
8686
}
8787

88+
/**
89+
* Use this method to execute the cleanup of the integration test namespace only in case the test
90+
* was successful. This is useful to keep the Kubernetes resources around to debug a failed test run.
91+
* Unfortunately I couldn't make this work with standard JUnit methods as the @AfterAll method doesn't know
92+
* if the tests succeeded or not.
93+
*
94+
* @param test The code of the actual test.
95+
* @throws Exception if the test threw an exception.
96+
*/
8897
public void teardownIfSuccess(TestRun test) throws Exception {
8998
try {
9099
test.run();

0 commit comments

Comments
 (0)