The GitHub Actions job "CI" on 
pekko-connectors-kafka.git/testkit-cleanup-resource-leaks has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
dacf57f61027aa569ad75fe55d37726942509664 / PJ Fanning 
<[email protected]>
release testkit resources when cleanup or startup fails

Motivation:
The testkit cleanup paths stop at the first failure.

`KafkaSpec.cleanUp` closes the test producer, then the admin client, then
shuts down the actor system. A failing producer close skips the other
two, so a suite that reuses a broker across classes leaks an admin client
and a whole actor system per failing class. `cleanUpAdminClient` also
leaves the closed client in place when `close` throws.

`KafkaContainerCluster.start` wraps any failure in a `RuntimeException`
without stopping the containers that already started. As
`TestcontainersKafka.stopCluster` only runs when the start completed, the
brokers stay up until Ryuk reaps them.

Modification:
Release every resource in `KafkaSpec.cleanUp` before rethrowing the first
failure, drop the admin client reference before closing it, and stop the
cluster when `KafkaContainerCluster.start` fails, adding a failing stop
as a suppressed exception.

Result:
A failure while releasing one testkit resource no longer leaks the
others.

Tests:
- sbt "tests/Test/testOnly 
org.apache.pekko.kafka.testkit.scaladsl.KafkaSpecCleanUpSpec" - 1 succeeded, 0 
failed (fails without the fix)
- sbt testkit/mimaReportBinaryIssues - success
- sbt javafmtCheckAll scalafmtCheckAll headerCheckAll - success, with JDK 17
- The `KafkaContainerCluster.start` change is not covered by a test, it needs a 
Docker cluster that fails to start

References:
None - resource leak audit of the main sources

Report URL: 
https://github.com/apache/pekko-connectors-kafka/actions/runs/34060229651

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to