Conversation
…teardown Katta Server for all AdminCLI IT only once.
There was a problem hiding this comment.
Pull request overview
This PR speeds up admin-cli integration tests by moving the Testcontainers docker-compose environment lifecycle from per-test-class (@BeforeAll/@AfterAll) to a single per-test-plan setup/teardown via a JUnit Platform TestExecutionListener.
Changes:
- Register a JUnit Platform
TestExecutionListenerviaMETA-INF/servicesfor the admin-cli test runtime. - Add
AdminCLIIntegrationTestSetupListenerto start/stop the docker-compose environment once per test plan when@Tag("cli")tests are present. - Remove docker-compose setup/teardown from
AbstractAdminCLIITso individual IT classes no longer start/stop containers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
admin-cli/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener |
Registers the listener so JUnit discovers it during test execution. |
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java |
Implements global docker-compose startup/shutdown for cli-tagged tests. |
admin-cli/src/test/java/cloud/katta/testsetup/AbstractAdminCLIIT.java |
Removes per-class container lifecycle hooks; keeps per-test authentication/client setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java
Outdated
Show resolved
Hide resolved
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java
Outdated
Show resolved
Hide resolved
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java
Show resolved
Hide resolved
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java
Outdated
Show resolved
Hide resolved
admin-cli/src/test/java/cloud/katta/testsetup/AdminCLIIntegrationTestSetupListener.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| final Properties props = new Properties(); | ||
| try { | ||
| props.load(AbstractAdminCLIIT.class.getResourceAsStream(envFile)); | ||
| } |
There was a problem hiding this comment.
props.load(AbstractAdminCLIIT.class.getResourceAsStream(envFile)) doesn’t close the underlying InputStream. Use try-with-resources (and optionally a null-check with a clearer exception) to avoid leaking file handles during test execution.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| catch(URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| compose.start(); |
There was a problem hiding this comment.
If compose.start() throws after partially starting containers, the environment may be left running because teardown might not execute. Consider wrapping startup in try/catch and stopping the compose environment on failure (or using a shutdown hook) so CI agents don't leak containers on startup errors.
| compose.start(); | |
| try { | |
| compose.start(); | |
| } | |
| catch(Exception e) { | |
| try { | |
| compose.stop(); | |
| } | |
| catch(Exception stopException) { | |
| log.warn("Failed to stop docker-compose test environment after startup failure", stopException); | |
| } | |
| compose = null; | |
| throw e; | |
| } |
Speed up AdminCLI ITs by implementing TestExecutionListener to setup/teardown Katta Server for all AdminCLI IT only once.