From ad98b865b7019c8e86f4f143ae573d086147f127 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Sun, 3 May 2015 18:50:24 -0700 Subject: [PATCH] integration: Run engines with --net=host. Since we were mapping the port back to the host anyway, this doesn't change anything. However, it does fix `docker exec`. Fixes #658 Signed-off-by: Andrea Luzzardi --- test/integration/api.bats | 6 ++---- test/integration/helpers.bash | 16 +++++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index 8bc21f872c..cc5cf55066 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -108,8 +108,7 @@ function teardown() { [[ "${lines[1]}" == *"Up"* ]] # grab the checksum of the test file inside the container. - # FIXME: if issue #658 solved, use 'exec' instead of 'exec -i' - run docker_swarm exec -i test_container md5sum $test_file + run docker_swarm exec test_container md5sum $test_file [ "$status" -eq 0 ] [ "${#lines[@]}" -ge 1 ] @@ -199,8 +198,7 @@ function teardown() { [[ "${lines[1]}" == *"Up"* ]] [[ "${lines[1]}" != *"Paused"* ]] - # FIXME: if issue #658 solved, use 'exec' instead of 'exec -i' - run docker_swarm exec -i test_container ls + run docker_swarm exec test_container ls [ "$status" -eq 0 ] [ "${#lines[@]}" -ge 2 ] [[ "${lines[0]}" == *"bin"* ]] diff --git a/test/integration/helpers.bash b/test/integration/helpers.bash index c832e04b60..3a65a4b13a 100644 --- a/test/integration/helpers.bash +++ b/test/integration/helpers.bash @@ -140,12 +140,18 @@ function start_docker() { for ((i=current; i < (current + instances); i++)); do local port=$(($BASE_PORT + $i)) HOSTS[$i]=127.0.0.1:$port - DOCKER_CONTAINERS[$i]=$(docker run -d --name node-$i -h node-$i --privileged \ - -p 127.0.0.1:$port:$port -it \ + + # We have to manually call `hostname` since --hostname and --net cannot + # be used together. + DOCKER_CONTAINERS[$i]=$( + docker run -d --name node-$i --privileged -it --net=host \ ${DOCKER_IMAGE}:${DOCKER_VERSION} \ - docker -d -H 0.0.0.0:$port \ - --storage-driver=$STORAGE_DRIVER --exec-driver=$EXEC_DRIVER \ - "$@") + bash -c "\ + hostname node-$i && \ + docker -d -H 127.0.0.1:$port \ + --storage-driver=$STORAGE_DRIVER --exec-driver=$EXEC_DRIVER \ + `join ' ' $@` \ + ") done # Wait for the engines to be reachable.