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

'EnvironmentAndSystemPropertyClientProviderStrategy' should handle empty DOCKER_HOST #5026

Closed
bsideup opened this issue Feb 5, 2022 · 2 comments · Fixed by #5983
Closed

Comments

@bsideup
Copy link
Member

bsideup commented Feb 5, 2022

Testcontainers fails to start if DOCKER_HOST is set to an empty string.

Reproducer:

export DOCKER_HOST=
// run the tests
@roulpriya
Copy link
Contributor

Hi,

I'm willing to work on this issue. I tried to reproduce this issue by setting DOCKER_HOST= but the test cases were passing. I was running the tests on MacBook pro m1 with macOS=12.6 and docker desktop= v4.12.0 with Docker version 20.10.17, build 100c701

@kiview
Copy link
Member

kiview commented Oct 10, 2022

Hey @roulpriya, great that you want to look into it.

This issue occurs, if docker.host is set in the ~/.testcontainers.properties file (e.g. to a valid value), but DOCKER_HOST is also set and is empty.

It will show such an error:

EnvironmentAndSystemPropertyClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "String.hashCode()" because "<local5>" is null)As no valid configuration was found, execution cannot continue.

The culprit is like this code right here, since it check only for a key, but not for empty value:

if (environment.containsKey(envVarName)) {
return environment.get(envVarName);
}

eddumelendez pushed a commit that referenced this issue Oct 10, 2022
Fixes #5026 

Signed-off-by: Priyambada Roul <[email protected]>
@kiview kiview added this to the next milestone Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants