lhotari opened a new pull request #9626: URL: https://github.com/apache/pulsar/pull/9626
### Motivation For debugging purposes, it is useful to have the ability to leave the integration test containers running after the test completes. For example, this feature was necessary in investigating the issue #9622 . It was possible to view the log files and find out the issue. If the containers are killed, this options is lost. ### Modifications [Testcontainers has a feature to disable "Ryuk"](https://www.testcontainers.org/features/configuration/#disabling-ryuk), the automatic container cleanup which usually kills all containers started by Testcontainers after the JVM shuts down. This mode can be activated by setting environment variable `TESTCONTAINERS_RYUK_DISABLED=true`. This Testcontainers feature doesn't make a difference when the test code itself stops the containers. Therefore there should be handling in the test code itself to skip stopping of containers for debugging purposes. The modifications in this PR skip stopping PulsarContainer and PulsarCluster instances if environment variable `TESTCONTAINERS_RYUK_DISABLED=true` . ### Usage example In unix shells, one can pass environment variables by prepending the command with the variables: ``` TESTCONTAINERS_RYUK_DISABLED=true mvn -B -f tests/pom.xml test -DintegrationTests -DredirectTestOutputToFile=false -DtestRetryCount=0 -DfailIfNoTests=false -Dtest=CLITest ``` After the test run, one can use `docker ps` and `docker exec -it [container_name] bash` to get a shell in the running container that was left behind the test run when this feature introduced by this PR is active. When container cleanup is disabled, one can use this command after debugging to kill docker containers started by Testcontainers: ``` docker ps -q --filter "label=org.testcontainers=true" | xargs -r docker kill ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
