JAMES-2082 Always expose ports with dockerized tests
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/e01bcf46 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/e01bcf46 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/e01bcf46 Branch: refs/heads/master Commit: e01bcf468c8265662664c008129ab6bc2ba2df9c Parents: b74540e Author: benwa <[email protected]> Authored: Mon Jul 10 06:49:32 2017 +0700 Committer: Antoine Duprat <[email protected]> Committed: Mon Jul 10 14:24:00 2017 +0200 ---------------------------------------------------------------------- .../backends/es/ClientProviderImplConnectionTest.java | 12 +++++++----- .../test/java/org/apache/james/DockerCassandraRule.java | 3 ++- .../java/org/apache/james/DockerElasticSearchRule.java | 3 ++- .../java/org/apache/james/metric/es/ESReporterTest.java | 3 ++- .../apache/james/jmap/VacationRelayIntegrationTest.java | 9 ++++++--- 5 files changed, 19 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/e01bcf46/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java ---------------------------------------------------------------------- diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java index 36f7ad3..f6be380 100644 --- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java +++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java @@ -36,10 +36,12 @@ import com.jayway.awaitility.Awaitility; public class ClientProviderImplConnectionTest { private static final Logger LOGGER = LoggerFactory.getLogger(ClientProviderImplConnectionTest.class); private static final String DOCKER_ES_IMAGE = "elasticsearch:2.2.1"; + private static final int ES_APPLICATIVE_PORT = 9300; @Rule public SwarmGenericContainer es1 = new SwarmGenericContainer(DOCKER_ES_IMAGE) - .withAffinityToContainer(); + .withAffinityToContainer() + .withExposedPorts(ES_APPLICATIVE_PORT); @Rule public SwarmGenericContainer es2 = new SwarmGenericContainer(DOCKER_ES_IMAGE) @@ -60,8 +62,8 @@ public class ClientProviderImplConnectionTest { .pollInterval(5, TimeUnit.SECONDS) .until(() ->isConnected( ClientProviderImpl.fromHostsString( - es1.getIp() + ":" + 9300 + "," - + es2.getIp() + ":" + 9300))); + es1.getIp() + ":" + ES_APPLICATIVE_PORT + "," + + es2.getIp() + ":" + ES_APPLICATIVE_PORT))); } @Test @@ -73,8 +75,8 @@ public class ClientProviderImplConnectionTest { .pollInterval(5, TimeUnit.SECONDS) .until(() -> isConnected( ClientProviderImpl.fromHostsString( - es1.getIp() + ":" + 9300 + "," - + es2.getIp() + ":" + 9300))); + es1.getIp() + ":" + ES_APPLICATIVE_PORT + "," + + es2.getIp() + ":" + ES_APPLICATIVE_PORT))); } private boolean isConnected(ClientProvider clientProvider) { http://git-wip-us.apache.org/repos/asf/james-project/blob/e01bcf46/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java index 1d13b79..c59798e 100644 --- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java +++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java @@ -52,7 +52,8 @@ public class DockerCassandraRule implements GuiceModuleTestRule { return configuration; } - private SwarmGenericContainer cassandraContainer = new SwarmGenericContainer("cassandra:2.2"); + private SwarmGenericContainer cassandraContainer = new SwarmGenericContainer("cassandra:2.2") + .withExposedPorts(CASSANDRA_PORT); @Override public Statement apply(Statement base, Description description) { http://git-wip-us.apache.org/repos/asf/james-project/blob/e01bcf46/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerElasticSearchRule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerElasticSearchRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerElasticSearchRule.java index 8c713bd..4cd4186 100644 --- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerElasticSearchRule.java +++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerElasticSearchRule.java @@ -53,7 +53,8 @@ public class DockerElasticSearchRule implements GuiceModuleTestRule { return configuration; } - private SwarmGenericContainer elasticSearchContainer = new SwarmGenericContainer("elasticsearch:2.2.2"); + private SwarmGenericContainer elasticSearchContainer = new SwarmGenericContainer("elasticsearch:2.2.2") + .withExposedPorts(ELASTIC_SEARCH_HTTP_PORT, ELASTIC_SEARCH_PORT); @Override public Statement apply(Statement base, Description description) { http://git-wip-us.apache.org/repos/asf/james-project/blob/e01bcf46/server/container/metrics/metrics-es-reporter/src/test/java/org/apache/james/metric/es/ESReporterTest.java ---------------------------------------------------------------------- diff --git a/server/container/metrics/metrics-es-reporter/src/test/java/org/apache/james/metric/es/ESReporterTest.java b/server/container/metrics/metrics-es-reporter/src/test/java/org/apache/james/metric/es/ESReporterTest.java index da91772..293c80d 100644 --- a/server/container/metrics/metrics-es-reporter/src/test/java/org/apache/james/metric/es/ESReporterTest.java +++ b/server/container/metrics/metrics-es-reporter/src/test/java/org/apache/james/metric/es/ESReporterTest.java @@ -53,7 +53,8 @@ public class ESReporterTest { @Rule public SwarmGenericContainer esContainer = new SwarmGenericContainer("elasticsearch:2.2.2") - .withAffinityToContainer(); + .withAffinityToContainer() + .withExposedPorts(ES_HTTP_PORT, ES_APPLICATIVE_PORT); private ClientProvider clientProvider; private ESMetricReporter esMetricReporter; http://git-wip-us.apache.org/repos/asf/james-project/blob/e01bcf46/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java index 3fc48ff..dbc6816 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java @@ -55,9 +55,6 @@ import com.jayway.restassured.http.ContentType; public abstract class VacationRelayIntegrationTest { - @Rule - public final SwarmGenericContainer fakeSmtp = new SwarmGenericContainer("weave/rest-smtp-sink:latest"); - private static final String DOMAIN = "mydomain.tld"; private static final String USER = "benwa"; private static final String USER_WITH_DOMAIN = USER + '@' + DOMAIN; @@ -66,6 +63,12 @@ public abstract class VacationRelayIntegrationTest { private static final String LOCALHOST_IP = "127.0.0.1"; private static final int SMTP_PORT = 1025; + private static final int REST_SMTP_SINK_PORT = 25; + + @Rule + public final SwarmGenericContainer fakeSmtp = new SwarmGenericContainer("weave/rest-smtp-sink:latest") + .withExposedPorts(VacationRelayIntegrationTest.REST_SMTP_SINK_PORT); + private ConditionFactory calmlyAwait; private GuiceJamesServer guiceJamesServer; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
