Skip to content
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

JdbcDatabaseContainer doesn't have lazy image constructor #543

Closed
npetzall opened this issue Jan 13, 2018 · 6 comments
Closed

JdbcDatabaseContainer doesn't have lazy image constructor #543

npetzall opened this issue Jan 13, 2018 · 6 comments

Comments

@npetzall
Copy link

Hi

Is there a reason why JdbcDatabaseContainer doesn't have the super constructor with Future image)?

public JdbcDatabaseContainer(@NonNull final Future<String> image) {
        super(image);
}
@iNikem
Copy link
Contributor

iNikem commented Jan 28, 2018

What is the use-case that requires this type of construction??

@npetzall
Copy link
Author

I want to be able to access the instance method getJdbcDriverInstance() before the images has been pulled.

I have written a junit wrapper library and the assumeDriver function is too slow. Since I use custom JDBC containers that requires proprietary drivers they might not be available and I want that to be checked before pulling the image.

Library exists more or less to add assumptions.

With the lazy loading I can skip the image pull if the driver is missing by skipping the test before it actually pulls/starts the container.

@iNikem
Copy link
Contributor

iNikem commented Jan 29, 2018

wow, I think the correct question is "why public GenericContainer(String dockerImageName) pulls the image?" :)

@bsideup
Copy link
Member

bsideup commented Jan 29, 2018

@iNikem yes, @rnorth, why? :D Jokes aside, AFAIR Richard wanted tests to fail fast if image pull fails.
We briefly discussed that when I was working on #106

@rnorth
Copy link
Member

rnorth commented Jan 29, 2018

Precisely that, to fail fast. If a test class declares multiple @Rules, it seem(s/ed?) bad to spend time starting some of them, but then fail to pull a non-existent image.

This was an old decision though - happy to revisit in light of how people want to use the tool nowadays, and whether this makes sense.

@npetzall
Copy link
Author

npetzall commented Jan 29, 2018

So adding the suppressed constructor wouldn't be a problem.

Other if possible solution would be to query repositories to see if image exists but to do pulling in start/tryStart.

DockerClient has a search cmd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants