github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/tests/bin/test-acceptance.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Preps a test environment and runs `make test-integration` 4 # against artifacts produced from the current source tree 5 # 6 7 # fail on any command exiting non-zero 8 set -eo pipefail 9 10 # absolute path to current directory 11 export THIS_DIR=$(cd $(dirname $0); pwd) 12 13 # setup the test environment 14 source $THIS_DIR/test-setup.sh 15 16 # setup callbacks on process exit and error 17 trap cleanup EXIT 18 trap dump_logs ERR 19 20 log_phase "Running documentation tests" 21 22 # test building documentation 23 make -C docs/ test 24 25 log_phase "Running unit tests" 26 27 make test-unit 28 29 log_phase "Building from current source tree" 30 31 # build all docker images and client binaries 32 make build 33 34 # use the built client binaries 35 export PATH=$DEIS_ROOT/deisctl:$DEIS_ROOT/client/dist:$PATH 36 37 log_phase "Running functional tests" 38 39 make test-functional 40 41 log_phase "Provisioning 3-node CoreOS" 42 43 export DEIS_NUM_INSTANCES=3 44 make discovery-url 45 vagrant up --provider virtualbox 46 47 log_phase "Waiting for etcd/fleet" 48 49 until deisctl list >/dev/null 2>&1; do 50 sleep 1 51 done 52 53 log_phase "Provisioning Deis on old release" 54 55 function set_release { 56 deisctl config $1 set image=deis/$1:$2 57 } 58 set_release logger ${OLD_TAG} 59 set_release router ${OLD_TAG} 60 set_release database ${OLD_TAG} 61 set_release controller ${OLD_TAG} 62 set_release registry ${OLD_TAG} 63 64 deisctl install platform 65 time deisctl start platform 66 67 log_phase "Running smoke tests" 68 69 time make test-smoke 70 71 log_phase "Publishing new release" 72 73 time make release 74 75 log_phase "Updating channel with new release" 76 77 updateservicectl channel update --app-id=${APP_ID} --channel=${CHANNEL} --version=${BUILD_TAG} --publish=true 78 79 log_phase "Waiting for upgrade to complete" 80 81 # configure platform settings 82 deisctl config platform set domain=$DEIS_TEST_DOMAIN 83 deisctl config platform set sshPrivateKey=$DEIS_TEST_SSH_KEY 84 deisctl config platform channel=${CHANNEL} autoupdate=true 85 86 function wait_for_update { 87 set -x 88 vagrant ssh $1 -c "journalctl -n 500 -u deis-updater.service -f" & 89 pid_$1=$! 90 vagrant ssh $1 -c "/bin/sh -c \"while [[ \"\$(cat /etc/deis-version)\" != \"${BUILD_TAG}\" ]]; do echo waiting for update to complete...; sleep 5; done\"" 91 kill $pid_$1 92 set +x 93 } 94 95 wait_for_update deis-1 & 96 update1=$! 97 wait_for_update deis-2 & 98 update2=$! 99 wait_for_update deis-3 & 100 update3=$! 101 wait update1 update2 update3 102 103 log_phase "Running end-to-end integration test with Python client" 104 105 time make test-integration