GRPC Cleanup Extension for JUnit 5
Blog post from StackHawk
The grpc-java project offers GrpcCleanupRule for cleaning up Grpc Service resources in JUnit 4 tests, but it is incompatible with JUnit 5, which utilizes extensions instead of the @Rule classes used in JUnit 4. Despite the GRPC team's recommendation to continue using JUnit 4, StackHawk has developed a JUnit 5 extension named GrpcCleanupExtension to automatically manage resource cleanup and prevent test pollution. This extension, which mirrors the functionality of GrpcCleanupRule, tracks and shuts down server and channel resources after each test execution via the afterEach function. By implementing this extension, StackHawk ensures that resources are properly terminated, thereby maintaining test reliability and cleanliness.