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

Improve Docker Compose error messaging #2154

Merged
merged 24 commits into from Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ca49bb7
new: startup certain services
May 31, 2019
c7a0174
add: better modularisation
Jun 3, 2019
a93e44b
add: tests for the new implementation
Jun 4, 2019
887446e
Merge branch 'master' into feature/startup-certain-services
HaMatthias Jun 4, 2019
247fd19
Merge branch 'master' into feature/startup-certain-services
HaMatthias Jun 5, 2019
cb49801
Merge branch 'master' into feature/startup-certain-services
HaMatthias Jun 7, 2019
0fe939f
Merge branch 'master' into feature/startup-certain-services
HaMatthias Jun 11, 2019
0bfd440
Update .gitignore
HaMatthias Jun 11, 2019
b145b8a
Update DockerComposeServiceTest.java
HaMatthias Jun 11, 2019
954ebf6
fix: Correct exception Handling with failure message
Jun 24, 2019
3de96c8
fix: Exception handling for non existing portmappings
Jun 25, 2019
f1dc5bf
Merge branch 'master' into fix/Map-execption-semantically-correct
HaMatthias Jul 22, 2019
f975102
Merge branch 'master' into fix/Map-execption-semantically-correct
rnorth Aug 6, 2019
c8a1e84
Merge branch 'master' into fix/Map-execption-semantically-correct
rnorth Oct 8, 2019
dd519bc
Merge branch 'master' into fix/Map-execption-semantically-correct
rnorth Oct 8, 2019
268b7ad
Merge branch 'master' into fix/Map-execption-semantically-correct
rnorth Oct 17, 2019
227d3c8
Merge branch 'master' into fix/Map-execption-semantically-correct
HaMatthias Nov 1, 2019
f3a2b8b
Update core/src/main/java/org/testcontainers/containers/DockerCompose…
HaMatthias Nov 1, 2019
3de7385
Update core/src/main/java/org/testcontainers/containers/DockerCompose…
HaMatthias Nov 1, 2019
8520c29
Update core/src/main/java/org/testcontainers/containers/DockerCompose…
HaMatthias Nov 1, 2019
9b68a7d
Update core/src/main/java/org/testcontainers/containers/DockerCompose…
HaMatthias Nov 1, 2019
071aab7
Update core/src/main/java/org/testcontainers/containers/DockerCompose…
HaMatthias Nov 1, 2019
89b3bb1
Fix typo
rnorth Dec 5, 2019
8ef2fea
Merge branch 'master' into fix/Map-execption-semantically-correct
rnorth Dec 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -385,7 +385,15 @@ public String getServiceHost(String serviceName, Integer servicePort) {
* @return a port that can be used for accessing the service container.
*/
public Integer getServicePort(String serviceName, Integer servicePort) {
return ambassadorContainer.getMappedPort(ambassadorPortMappings.get(getServiceInstanceName(serviceName)).get(servicePort));
Map<Integer, Integer> portMap = ambassadorPortMappings.get(getServiceInstanceName(serviceName));

if (portMap == null) {
throw new IllegalArgumentException("Could not get a port for '" + serviceName + "'. " +
"Testcontainers does not have an exposed port configured for '" + serviceName + "'. "+
"To fix, please ensure that the service '" + serviceName + "' has ports exposed using .withExposedService(...)");
} else {
return ambassadorContainer.getMappedPort(portMap.get(servicePort));
}
}

public SELF withScaledService(String serviceBaseName, int numInstances) {
Expand Down
Expand Up @@ -21,7 +21,7 @@ protected DockerComposeContainer getEnvironment() {
return environment;
}

@Test(expected = NullPointerException.class)
@Test(expected = IllegalArgumentException.class)
public void testDbIsNotStarting() {
environment.getServicePort("db_1", 10001);
}
Expand Down