Skip to content

testing: Have GrpcCleanupRule extend ExternalResource - #9240

Merged
ejona86 merged 1 commit into
grpc:masterfrom
ejona86:cleanuprule-externalresource
Jun 9, 2022
Merged

ejona86 merged 1 commit into
grpc:masterfrom
ejona86:cleanuprule-externalresource

Conversation

@ejona86

@ejona86 ejona86 commented Jun 6, 2022

Copy link
Copy Markdown
Member

This allows using GrpcCleanupRule with JUnit 5 when combined with
ExternalResourceSupport. We don't really lose anything important when
running with JUnit 4 and this eases migration to JUnit 5.

ExternalResource is now responsible for combining exceptions. after()
cannot throw checked exceptions, so we must now wrap the
InterruptedException. When used with JUnit 5 we are unable to detect the
test failed; we accept that for now but it may be fair to create a new
class for JUnit 5 to be used with @RegisterExtension that implements
BeforeEachCallback and AfterTestExecutionCallback to restore the JUnit 4
behavior.

See #5331

This allows using GrpcCleanupRule with JUnit 5 when combined with
ExternalResourceSupport. We don't really lose anything important when
running with JUnit 4 and this eases migration to JUnit 5.

ExternalResource is now responsible for combining exceptions. after()
cannot throw checked exceptions, so we must now wrap the
InterruptedException. When used with JUnit 5 we are unable to detect the
test failed; we accept that for now but it may be fair to create a new
class for JUnit 5 to be used with `@RegisterExtension` that implements
BeforeEachCallback and AfterTestExecutionCallback to restore the JUnit 4
behavior.

See grpc#5331
@ejona86
ejona86 merged commit 97845fb into grpc:master Jun 9, 2022
@ejona86
ejona86 deleted the cleanuprule-externalresource branch June 9, 2022 17:26
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants