Files
weave/test/615_proxy_rewrite_hosts_test.sh
Marc CARRE 43249a8d39 Change all launch-*/stop-* commands to launch/stop.
Given `proxy` & `router` processes have been merged, `launch-proxy`,
`launch-router`, `stop-proxy`, `stop-router` do not make sense any more, and
should just be `launch` and `stop` with the appropriate flags.
2017-05-10 10:25:36 +00:00

33 lines
718 B
Bash
Executable File

#! /bin/bash
. "$(dirname "$0")/config.sh"
expected_ip=10.2.1.1
image_ip() {
proxy docker_on $HOST1 run -e "WEAVE_CIDR=$expected_ip/24" $1 hostname -i | cut -d' ' -f1
}
start_suite "Proxy rewrites hosts file"
# Default rewrites the host file
weave_on $HOST1 launch
assert "image_ip $SMALL_IMAGE" $expected_ip
# When container user is non-root
docker_on $HOST1 build -t non-root >/dev/null - <<- EOF
FROM $SMALL_IMAGE
RUN adduser -D -s /bin/sh user
ENV HOME /home/user
USER user
CMD true
EOF
assert "image_ip non-root" $expected_ip
# When rewrite hosts is disabled
weave_on $HOST1 stop
weave_on $HOST1 launch --no-rewrite-hosts
assert_raises "image_ip $SMALL_IMAGE | grep -v $expected_ip"
end_suite