Make TestcontainersExtension public by hmatt1 · Pull Request #5285 · testcontainers/testcontainers-java (original) (raw)

@kiview It is mentioned in the issue that one user wanted to do some registry authentication config: #2045 (comment)

The issue also mentions

Some microservices frameworks have extension to start the application for integration testing, whe using test containers, we need to be sure that the testcontainers extension run first to start the containers before the apps starts.

I'm not familiar with the specific extensions the users are referring to. However, in the docs I linked to, they provide this example of defining a custom composed annotation that combines multiple extensions in a reusable way.

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith({ DatabaseExtension.class, WebServerExtension.class })
public @interface DatabaseAndWebServerExtension {
}

This is another use case that isn't supported when the TestcontainersExtension class is package-private. This is something I wanted to take advantage of in my project, since we have a few extensions we are using across our tests and would like to define them in one place.