From ff86370df8199973b6d5ee2035d3516c78990a9f Mon Sep 17 00:00:00 2001 From: Paul Bellamy Date: Tue, 11 Aug 2015 11:38:00 +0100 Subject: [PATCH] fixing and simplifying circle build The integration tests were using two different versions of weave. One to launch the weave container, and another used by scope. --- circle.yml | 5 ++--- integration/200_clustering_2_test.sh | 3 ++- integration/config.sh | 24 +++++++++++++----------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/circle.yml b/circle.yml index d5241c65a..6d40a437b 100644 --- a/circle.yml +++ b/circle.yml @@ -13,7 +13,7 @@ machine: CLOUDSDK_CORE_DISABLE_PROMPTS: 1 SCOPE_UI_BUILD: $HOME/docker/scope_ui_build.tar WEAVE_REPO: github.com/weaveworks/weave - WEAVE_ROOT: "${GOPATH%%:*}/src/github.com/weaveworks/weave" + WEAVE_ROOT: /home/ubuntu/src/github.com/weaveworks/weave dependencies: cache_directories: @@ -24,9 +24,8 @@ dependencies: - curl https://sdk.cloud.google.com | bash - test -z "$SECRET_PASSWORD" || bin/setup-circleci-secrets "$SECRET_PASSWORD" post: - - git clone --depth 1 -b master https://$WEAVE_REPO.git "$WEAVE_ROOT" - go get $WEAVE_REPO/... - - cd $WEAVE_ROOT; make testing/runner/runner + - make -C $WEAVE_ROOT testing/runner/runner - sudo apt-get install jq - go version - go clean -i net diff --git a/integration/200_clustering_2_test.sh b/integration/200_clustering_2_test.sh index f42058632..e2bd9b75e 100755 --- a/integration/200_clustering_2_test.sh +++ b/integration/200_clustering_2_test.sh @@ -5,6 +5,7 @@ start_suite "Launch 2 scopes and check they cluster" weave_on $HOST2 launch +weave_on $HOST2 launch-dns docker_on $HOST2 run -dit --name db1 peterbourgon/tns-db container_id=$(docker_on $HOST2 run -dit --name app1 --link db1:db1 peterbourgon/tns-app) @@ -13,7 +14,7 @@ scope_on $HOST2 launch $HOST1 SUCCESS= for i in {1..10}; do - if (curl $HOST1:4040/api/topology/containers | grep "$container_id" >/dev/null); then + if (curl -s $HOST1:4040/api/topology/containers | grep "$container_id" >/dev/null); then SUCCESS=1 break fi diff --git a/integration/config.sh b/integration/config.sh index cef153873..c3f463624 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -7,16 +7,11 @@ set -e export SSH_DIR="$PWD" export HOSTS -WEAVE_REPO="github.com/weaveworks/weave" -WEAVE_ROOT="${GOPATH%%:*}/src/$WEAVE_REPO" -if [ ! -d "$WEAVE_ROOT" ] ; then - mkdir -p "$(dirname "$WEAVE_ROOT")" - git clone --depth 1 -b master https://$WEAVE_REPO.git "$WEAVE_ROOT" - go get $WEAVE_REPO/... -fi -if [ ! -x "$WEAVE_ROOT/testing/runner/runner" ] ; then - (cd "$WEAVE_ROOT" && make testing/runner/runner) -fi +: ${WEAVE_REPO:=github.com/weaveworks/weave} +: ${WEAVE_ROOT:="$(go list -e -f {{.Dir}} $WEAVE_REPO)"} + +RUNNER="$WEAVE_ROOT/testing/runner/runner" +[ -x "$RUNNER" ] || (echo "Could not find weave test runner at $RUNNER." >&2 ; exit 1) . "$WEAVE_ROOT/test/config.sh" @@ -24,5 +19,12 @@ scope_on() { host=$1 shift 1 [ -z "$DEBUG" ] || greyly echo "Scope on $host: $@" >&2 - run_on $host "DOCKER_HOST=tcp://$host:$DOCKER_PORT" scope "$@" + run_on $host DOCKER_HOST=tcp://$host:$DOCKER_PORT scope "$@" +} + +weave_on() { + host=$1 + shift 1 + [ -z "$DEBUG" ] || greyly echo "Weave on $host: $@" >&2 + run_on $host DOCKER_HOST=tcp://$host:$DOCKER_PORT weave "$@" }