-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start shared containers in beforeAll callback (Jupiter) #1020
Conversation
I took the freedom to have a look at the extensions. Reads good from my point of view. What I didn't try out: How is the behaviour in regard to I probably would expect the container still being running in "my" after all methods. |
So we are storing all containers inside the Not really sure about the specific point in time this will occur though. |
I tested this branch and from all I can tell it would fix the issue outlined in #1017 (see #1017 (comment) clarifying the situation together with a reproducer). |
@jrehwaldt Thanks, sounds great. |
@Override | ||
public void beforeAll(ExtensionContext context) { | ||
Class<?> testClass = context.getTestClass() | ||
.orElseThrow(() -> new ExtensionConfigurationException("TestcontainersExtension is only supported for classes.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. Although would be nice to test orElseThrow
@bsideup Yeah, I will add another ignored test and check it by hand. |
So I don't really know a way to force the exception, I kind of think, it can't happen for a user. class WrongExtensionUsageTests {
@Testcontainers
enum myEnum {
FOOBAR
}
@Test
void extension_throws_exception() {
assert true;
}
} This won't execute the |
Released in 1.10.4! |
I've probably missed some edge cases, but all current tests are green.
We also explicitly don't support parallel test execution at this point.
Fixes #1019.