diff --git a/circle.yml b/circle.yml index a11d50ff..338fbbe4 100644 --- a/circle.yml +++ b/circle.yml @@ -17,13 +17,13 @@ dependencies: cache_directories: - "~/docker" override: - - if [[ -e "$WEAVE_BUILD" ]]; then - docker load -i $WEAVE_BUILD; - else - docker pull weaveworks/weave-build; - mkdir -p $(dirname "$WEAVE_BUILD"); - docker save weaveworks/weave-build >$WEAVE_BUILD; - fi + - if [[ -e "$WEAVE_BUILD" ]]; then + docker load -i $WEAVE_BUILD; + else + docker pull weaveworks/weave-build; + mkdir -p $(dirname "$WEAVE_BUILD"); + docker save weaveworks/weave-build >$WEAVE_BUILD; + fi post: - curl https://sdk.cloud.google.com | bash - bin/setup-circleci-secrets "$SECRET_PASSWORD" @@ -32,9 +32,14 @@ dependencies: test: override: - - docker run -v /var/run/docker.sock:/run/docker.sock -v /home/ubuntu:/home/go weaveworks/weave-build - - cd $SRCDIR/test; ./gce.sh setup - - cd $SRCDIR/test; . ./gce.sh hosts; ./setup.sh - - cd $SRCDIR/test; . ./gce.sh hosts; ./run_all.sh + - docker run -v /var/run/docker.sock:/run/docker.sock -v /home/ubuntu:/home/go weaveworks/weave-build: + parallel: true + - cd $SRCDIR/test; ./gce.sh setup: + parallel: true + - cd $SRCDIR/test; . ./gce.sh hosts; ./setup.sh: + parallel: true + - cd $SRCDIR/test; . ./gce.sh hosts; ./run_all.sh: + parallel: true post: - - cd $SRCDIR/test; ./gce.sh destroy + - cd $SRCDIR/test; ./gce.sh destroy: + parallel: true diff --git a/test/100_cross_hosts_test.sh b/test/100_cross_hosts_test.sh index 7c8502da..6d9a0e30 100755 --- a/test/100_cross_hosts_test.sh +++ b/test/100_cross_hosts_test.sh @@ -10,8 +10,8 @@ start_suite "Ping over cross-host weave network" weave_on $HOST1 launch weave_on $HOST2 launch $HOST1 -weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu -weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu +weave_on $HOST2 run $C2/24 -t --name=c2 gliderlabs/alpine /bin/sh +weave_on $HOST1 run $C1/24 -t --name=c1 gliderlabs/alpine /bin/sh assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2" end_suite diff --git a/test/110_encryption_test.sh b/test/110_encryption_test.sh index 7ba2ebb3..e5099b68 100755 --- a/test/110_encryption_test.sh +++ b/test/110_encryption_test.sh @@ -10,8 +10,8 @@ start_suite "Ping over encrypted cross-host weave network" weave_on $HOST1 launch -password notverysecure weave_on $HOST2 launch -password notverysecure $HOST1 -weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu -weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu +weave_on $HOST2 run $C2/24 -t --name=c2 gliderlabs/alpine /bin/sh +weave_on $HOST1 run $C1/24 -t --name=c1 gliderlabs/alpine /bin/sh assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2" end_suite diff --git a/test/130_expose_test.sh b/test/130_expose_test.sh index 8a9917b4..16240f78 100755 --- a/test/130_expose_test.sh +++ b/test/130_expose_test.sh @@ -34,7 +34,7 @@ start_suite "exposing weave network to host" weave_on $HOST1 launch for c in $C1 $C2 $C3 $C4; do - weave_on $HOST1 run ${c#*:}/24 -t --name=${c%:*} ubuntu + weave_on $HOST1 run ${c#*:}/24 -t --name=${c%:*} gliderlabs/alpine /bin/sh done # absence of host connectivity by default diff --git a/test/200_dns_test.sh b/test/200_dns_test.sh index d5161beb..b0717349 100755 --- a/test/200_dns_test.sh +++ b/test/200_dns_test.sh @@ -10,7 +10,7 @@ start_suite "Resolve names on a single host" weave_on $HOST1 launch-dns 10.2.254.1/24 -weave_on $HOST1 run $C2/24 -t --name=c2 -h $NAME ubuntu +weave_on $HOST1 run $C2/24 -t --name=c2 -h $NAME gliderlabs/alpine /bin/sh weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh assert_dns_record $HOST1 c1 $NAME $C2 diff --git a/test/210_dns_multicast_test.sh b/test/210_dns_multicast_test.sh index 91235c53..a315028e 100755 --- a/test/210_dns_multicast_test.sh +++ b/test/210_dns_multicast_test.sh @@ -14,7 +14,7 @@ weave_on $HOST2 launch $HOST1 weave_on $HOST1 launch-dns 10.2.254.1/24 -debug weave_on $HOST2 launch-dns 10.2.254.2/24 -debug -weave_on $HOST2 run $C2/24 -t --name=c2 -h $NAME ubuntu +weave_on $HOST2 run $C2/24 -t --name=c2 -h $NAME gliderlabs/alpine /bin/sh weave_on $HOST1 run --with-dns $C1/24 --name=c1 -t aanand/docker-dnsutils /bin/sh assert_dns_record $HOST1 c1 $NAME $C2 diff --git a/test/220_dns_custom_test.sh b/test/220_dns_custom_test.sh index 6603d555..35d14d91 100755 --- a/test/220_dns_custom_test.sh +++ b/test/220_dns_custom_test.sh @@ -11,7 +11,7 @@ start_suite "Resolve names in custom domain" weave_on $HOST1 launch-dns 10.2.254.1/24 --domain $DOMAIN. -weave_on $HOST1 run $C2/24 -t --name=c2 -h $NAME ubuntu +weave_on $HOST1 run $C2/24 -t --name=c2 -h $NAME gliderlabs/alpine /bin/sh weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh assert_dns_record $HOST1 c1 $NAME $C2 diff --git a/test/230_dns_unqualified_test.sh b/test/230_dns_unqualified_test.sh index 525c48d7..3ceab5fc 100755 --- a/test/230_dns_unqualified_test.sh +++ b/test/230_dns_unqualified_test.sh @@ -12,7 +12,7 @@ start_suite "Resolve unqualified names" weave_on $HOST1 launch-dns 10.2.254.1/24 -weave_on $HOST1 run $C1/24 -t --name=c1 -h $NAME ubuntu +weave_on $HOST1 run $C1/24 -t --name=c1 -h $NAME gliderlabs/alpine /bin/sh weave_on $HOST1 run --with-dns $C2/24 -t --name=c2 -h seetwo.$DOMAIN aanand/docker-dnsutils /bin/sh weave_on $HOST1 run --with-dns $C3/24 -t --name=c3 --dns-search=weave.local aanand/docker-dnsutils /bin/sh diff --git a/test/240_dns_add_name_test.sh b/test/240_dns_add_name_test.sh index 20393a5a..45697ec6 100755 --- a/test/240_dns_add_name_test.sh +++ b/test/240_dns_add_name_test.sh @@ -11,7 +11,7 @@ start_suite "Add and remove names on a single host" weave_on $HOST1 launch-dns 10.2.254.1/24 -weave_on $HOST1 run $C2/24 -t --name=c2 ubuntu +weave_on $HOST1 run $C2/24 -t --name=c2 gliderlabs/alpine /bin/sh weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh weave_on $HOST1 dns-add $C2 c2 -h $NAME2 diff --git a/test/400_weave_local_test.sh b/test/400_weave_local_test.sh index 34d012fc..286f986f 100755 --- a/test/400_weave_local_test.sh +++ b/test/400_weave_local_test.sh @@ -9,7 +9,7 @@ run_on $HOST1 sudo ./weave --local reset run_on $HOST1 sudo ./weave --local launch assert_raises "docker_on $HOST1 ps | grep weave" -run_on $HOST1 sudo ./weave --local run 10.2.6.5/24 -ti --name=c1 ubuntu +run_on $HOST1 sudo ./weave --local run 10.2.6.5/24 -ti --name=c1 gliderlabs/alpine /bin/sh assert_raises "exec_on $HOST1 c1 ifconfig | grep ethwe" end_suite diff --git a/test/500_weave_multi_cidr_test.sh b/test/500_weave_multi_cidr_test.sh index eb8e3ddc..f9cdf3d8 100755 --- a/test/500_weave_multi_cidr_test.sh +++ b/test/500_weave_multi_cidr_test.sh @@ -58,7 +58,7 @@ assert_bridge_cidrs() { } # Run container with three cidrs -CID=$(DOCKER_HOST=tcp://$HOST1:2375 $WEAVE run 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 -t --name multicidr -h multicidr.weave.local ubuntu | cut -b 1-12) +CID=$(DOCKER_HOST=tcp://$HOST1:2375 $WEAVE run 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 -t --name multicidr -h multicidr.weave.local gliderlabs/alpine /bin/sh | cut -b 1-12) assert_container_cidrs $HOST1 $CID 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24 assert_zone_records $HOST1 $CID multicidr.weave.local. 10.2.1.1 10.2.2.1 10.2.3.1 diff --git a/test/gce.sh b/test/gce.sh index 0a42948a..bf632993 100755 --- a/test/gce.sh +++ b/test/gce.sh @@ -14,8 +14,8 @@ TEMPLATE_NAME="test-template" ZONE=us-central1-a NUM_HOSTS=2 SUFFIX="" -if [ -n "$CIRCLECI" -a -n "$CIRCLE_SHA1" ]; then - SUFFIX="-${CIRCLE_SHA1:0:7}" +if [ -n "$CIRCLECI" ]; then + SUFFIX="-${CIRCLE_BUILD_NUM}-$CIRCLE_NODE_INDEX" fi # Setup authentication @@ -45,10 +45,9 @@ function internal_ip { } function try_connect { - for i in $(seq 0 10); do - if ssh -t $1 true; then - return - fi + for i in {0..10}; do + ssh -t $1 true && return + sleep 2 done } diff --git a/test/run_all.sh b/test/run_all.sh index 5ea2755d..7007925d 100755 --- a/test/run_all.sh +++ b/test/run_all.sh @@ -24,7 +24,19 @@ check_test_status() { # Overwrite assert.sh _assert_cleanup trap with our own trap check_test_status EXIT -for t in *_test.sh; do +# If running on circle, only run the tests for my "shard". +# CIRCLE_NODE_TOTAL is the total number of shards, and +# CIRCLE_NODE_INDEX is my index. +i=0 +TESTS= +for test in *_test.sh; do + if [ -z "$CIRCLECI" ] || [ $(($i % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ]; then + TESTS="$TESTS $test" + fi + i=$(($i + 1)) +done + +for t in $TESTS; do echo greyly echo "---= Running $t =---" . $t