Skip to content

Commit

Permalink
Merge pull request #396 from mesos/bug/392-NetworkingHostname
Browse files Browse the repository at this point in the history
Bug: Added hosts to TimeoutSchedulerContainer.
  • Loading branch information
Phil Winder committed Nov 3, 2015
2 parents 42afe78 + 1fc0fe8 commit d79e036
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.apache.mesos.elasticsearch.systemtest;

import com.containersol.minimesos.mesos.MesosSlave;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerCmd;
import org.apache.mesos.elasticsearch.common.cli.ElasticsearchCLIParameter;
Expand All @@ -16,6 +17,8 @@

import java.io.IOException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static com.jayway.awaitility.Awaitility.await;
Expand Down Expand Up @@ -119,10 +122,13 @@ protected TimeoutSchedulerContainer(DockerClient dockerClient, String zkIp) {

@Override
protected CreateContainerCmd dockerCommand() {
List<MesosSlave> slaves = Arrays.asList(CLUSTER.getSlaves());

return dockerClient
.createContainerCmd(getTestConfig().getSchedulerImageName())
.withName(getTestConfig().getSchedulerName() + "_" + new SecureRandom().nextInt())
.withEnv("JAVA_OPTS=-Xms128m -Xmx256m")
.withExtraHosts(slaves.stream().map(mesosSlave -> mesosSlave.getHostname() + ":" + DOCKER0_ADAPTOR_IP_ADDRESS).toArray(String[]::new))
.withCmd(
ZookeeperCLIParameter.ZOOKEEPER_MESOS_URL, getZookeeperMesosUrl(),
Configuration.EXECUTOR_HEALTH_DELAY, "99",
Expand Down

0 comments on commit d79e036

Please sign in to comment.