Skip to content

Comments

getServicePort on DockerComposeContainer throws NullPointerException if service instance number in not used.#619

Merged
rnorth merged 1 commit intotestcontainers:masterfrom
barrycommins:619
Mar 26, 2018
Merged

getServicePort on DockerComposeContainer throws NullPointerException if service instance number in not used.#619
rnorth merged 1 commit intotestcontainers:masterfrom
barrycommins:619

Conversation

@barrycommins
Copy link
Contributor

This is quite a minor one, but maybe worth fixing for consistency.

It is possible to expose a service in DockerComposeContainer without specifying the instance number:

new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
        .withExposedService("redis", 6379)

but when you then call getServicePort("redis", 6379), a NullPointerException is thrown.

It works ok with getServicePort("redis_1", 6379)

…ption if service instance number in not used.
@bsideup bsideup added this to the next milestone Mar 23, 2018
@bsideup bsideup requested review from kiview and rnorth March 23, 2018 07:11
@bsideup
Copy link
Member

bsideup commented Mar 23, 2018

@barrycommins nice! Was planning to do exactly that :D Thanks for contributing it :)

@kiview
Copy link
Member

kiview commented Mar 23, 2018

LGTM, I just deleted the corrupted Travis caches and restarted the build, should suceed now.

@rnorth
Copy link
Member

rnorth commented Mar 26, 2018

Great! Thanks for this.
I'll merge.

@rnorth rnorth merged commit 37456ae into testcontainers:master Mar 26, 2018
@barrycommins barrycommins deleted the 619 branch March 27, 2018 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants