From 2c7693b2c54208fce77837998700391c474fdf20 Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Tue, 9 May 2017 14:36:35 +0100 Subject: [PATCH] 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 --- test/090_docker_restart_policy_2_test.sh | 10 ++-------- test/620_proxy_entrypoint_command_test.sh | 7 +------ test/630_proxy_dns_test.sh | 4 ---- test/650_proxy_env_test.sh | 1 - test/660_proxy_ipam_2_test.sh | 4 ++-- test/680_proxy_hostname_derivation_test.sh | 2 -- test/695_proxy_failure_modes_test.sh | 12 ------------ 7 files changed, 5 insertions(+), 35 deletions(-) delete mode 100755 test/695_proxy_failure_modes_test.sh diff --git a/test/090_docker_restart_policy_2_test.sh b/test/090_docker_restart_policy_2_test.sh index e1630bc9..938bd834 100755 --- a/test/090_docker_restart_policy_2_test.sh +++ b/test/090_docker_restart_policy_2_test.sh @@ -5,21 +5,15 @@ start_suite "Test docker restart policy" weave_on $HOST1 launch - -assert "docker_on $HOST1 inspect -f '{{.HostConfig.RestartPolicy.Name}}' weave weaveproxy" "always\nalways" - +assert "docker_on $HOST1 inspect -f '{{.HostConfig.RestartPolicy.Name}}' weave" "always" assert_raises "check_restart $HOST1 weave" -assert_raises "check_restart $HOST1 weaveproxy" # stop + launch tests that restart policy changes result # in the old containers being removed and new ones created weave_on $HOST1 stop weave_on $HOST1 launch --no-restart - -assert "docker_on $HOST1 inspect -f '{{.HostConfig.RestartPolicy.Name}}' weave weaveproxy" "no\nno" - +assert "docker_on $HOST1 inspect -f '{{.HostConfig.RestartPolicy.Name}}' weave weaveproxy" "no" assert_raises "! check_restart $HOST1 weave" -assert_raises "! check_restart $HOST1 weaveproxy" # Relaunch to prevent the `weave stop` in `end_suite` # timing out trying to remove the plugin network diff --git a/test/620_proxy_entrypoint_command_test.sh b/test/620_proxy_entrypoint_command_test.sh index 38f26e74..3187257f 100755 --- a/test/620_proxy_entrypoint_command_test.sh +++ b/test/620_proxy_entrypoint_command_test.sh @@ -26,13 +26,8 @@ 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 -# NOTE: docker-kill hangs (https://github.com/docker/docker/issues/31447), so we -# kill directly the weaveproxy process instead. -WEAVEPROXY_PID=$(container_pid $HOST1 weaveproxy) -$SSH $HOST1 "ps aux | grep weaveproxy" -run_on $HOST1 "sudo kill -9 $WEAVEPROXY_PID" -weave_on $HOST1 launch assert_raises "proxy docker_on $HOST1 run check-ethwe-up" diff --git a/test/630_proxy_dns_test.sh b/test/630_proxy_dns_test.sh index dc04442b..472c3dd7 100755 --- a/test/630_proxy_dns_test.sh +++ b/test/630_proxy_dns_test.sh @@ -23,10 +23,6 @@ start_suite "Proxy registers containers with dns" bridge_ip=$(weave_on $HOST1 docker-bridge-ip) -# Assert behaviour without weaveDNS -weave_on $HOST1 launch -do_assert_resolution assert_no_dns_record - # Assert behaviour with weaveDNS running weave_on $HOST1 launch do_assert_resolution assert_dns_record diff --git a/test/650_proxy_env_test.sh b/test/650_proxy_env_test.sh index 0fee49af..00a01e73 100755 --- a/test/650_proxy_env_test.sh +++ b/test/650_proxy_env_test.sh @@ -21,7 +21,6 @@ check # Check we can use the weave script through the proxy assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE version" assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE ps" -assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE launch" # Check we can use weave env/config with multiple -Hs specified weave_on $HOST1 stop diff --git a/test/660_proxy_ipam_2_test.sh b/test/660_proxy_ipam_2_test.sh index ef57a49e..1d2a6849 100755 --- a/test/660_proxy_ipam_2_test.sh +++ b/test/660_proxy_ipam_2_test.sh @@ -11,8 +11,8 @@ assert_no_ethwe() { start_suite "Ping proxied containers over cross-host weave network (with IPAM)" -weave_on $HOST1 launch --ipalloc-range $UNIVERSE -weave_on $HOST2 launch --ipalloc-range --no-default-ipalloc $UNIVERSE $HOST1 +weave_on $HOST1 launch --ipalloc-range $UNIVERSE +weave_on $HOST2 launch --ipalloc-range $UNIVERSE --no-default-ipalloc $HOST1 proxy_start_container $HOST1 --name=auto proxy_start_container $HOST1 --name=none -e WEAVE_CIDR=none diff --git a/test/680_proxy_hostname_derivation_test.sh b/test/680_proxy_hostname_derivation_test.sh index 561baf1f..b3d53bfa 100755 --- a/test/680_proxy_hostname_derivation_test.sh +++ b/test/680_proxy_hostname_derivation_test.sh @@ -43,8 +43,6 @@ test_cleanup() { start_suite "Hostname derivation" -weave_on $HOST1 launch - # Hostname derivation through container name substitutions test_setup --hostname-match '^[^-]+-(?P[^-]*)-[^-]+$' --hostname-replacement '$appname' # check that the normal container_name->hostname derivation doesn't break diff --git a/test/695_proxy_failure_modes_test.sh b/test/695_proxy_failure_modes_test.sh deleted file mode 100755 index 66df5245..00000000 --- a/test/695_proxy_failure_modes_test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -. "$(dirname "$0")/config.sh" - -start_suite "Proxy failure modes" - -# docker run should fail when weave router is not running -weave_on $HOST1 launch -assert_raises "! proxy docker_on $HOST1 run --rm $SMALL_IMAGE true" -assert_raises "proxy docker_on $HOST1 run --rm $SMALL_IMAGE true 2>&1 1>/dev/null | grep 'Error response from daemon: weave container is not present. Have you launched it?'" - -end_suite