Files
weave/test/620_proxy_entrypoint_command_test.sh
Marc CARRE 2c7693b2c5 Fix tests following proxy merge.
Remove tests of situations that don't exist any more and fix the following tests:

- Fix test 660: pass arguments in correct order.
- Fix test 620: no double launch, weave stop instead of kill -9.

  - Now that router and proxy have been merged, we should only call `weave launch` once.
  - `sudo kill -9` was introduced because we previously had `docker kill` (see: http://github.com/weaveworks/weave/commit/cb73b738621d57727072ae998cdeaec337f23a1a), because we had no `weave stop-proxy` yet (see: http://github.com/weaveworks/weave/commit/e31f21a6d224d61de1d8a940ea4b0b45cebc9723). Pre-proxy-merge, this should just have been `weave stop-proxy`, and now that router and proxy have been merged, we should just call `weave stop`.

- Fix test 650: no double launch.
- Fix test 630: remove redundant case & assertions.
- Fix test 090: remove irrelevant assertions.

PING
2017-05-10 10:25:36 +00:00

53 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
. "$(dirname "$0")/config.sh"
build_image() {
docker_on $HOST1 build -t $1 >/dev/null - <<- EOF
FROM $SMALL_IMAGE
ENTRYPOINT $2
CMD $3
EOF
}
run_container() {
assert_raises "proxy docker_on $HOST1 run -e 'WEAVE_CIDR=10.2.1.1/24' $1"
}
start_suite "Proxy uses correct entrypoint and command with weavewait"
weave_on $HOST1 launch --no-restart
build_image check-ethwe-up '["grep"]' '["^1$", "/sys/class/net/ethwe/carrier"]'
run_container "check-ethwe-up"
build_image grep '["grep"]' ''
run_container "grep ^1$ /sys/class/net/ethwe/carrier"
build_image false '["/bin/false"]' ''
run_container "--entrypoint='grep' false ^1$ /sys/class/net/ethwe/carrier"
weave_on $HOST1 stop
weave_on $HOST1 launch --ipalloc-range 10.2.2.0/24
assert_raises "proxy docker_on $HOST1 run check-ethwe-up"
create_container_json=$(cat <<-EOF
{
"Hostname":"c1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
"Tty":false,
"OpenStdin":false,
"StdinOnce":false,
"Image":"check-ethwe-up"
}
EOF
)
# Test a minimal request to the unversioned (v1.0) docker api
CONTAINER_ID=$(curl -s -X POST --header "Content-Type: application/json" http://$HOST1:12375/containers/create -d "$create_container_json" | sed -e 's/.*"Id":"\([^"]*\)".*/\1/')
assert_raises "proxy docker_on $HOST1 start -ai $CONTAINER_ID"
end_suite