From 25f1088edd233311a5224331be4407f6f83702af Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Tue, 4 Oct 2016 13:42:53 -0700 Subject: [PATCH] test: Fixes for release_pass Some fixes related to release_pass: o Create the output directory ./bin if it does not exist. o Define the GOARCH variable if it is not defined. o Simplify the race detection test. o Download the relese archive based on GOARCH. o If the release file is not found, return success. This will allow the tests to continue. Signed-off-by: Geoff Levand --- test | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/test b/test index 4088bb54e..3a03ea6c7 100755 --- a/test +++ b/test @@ -33,6 +33,10 @@ TEST_PKGS=`find . -name \*_test.go | while read a; do dirname $a; done | sort | FORMATTABLE=`find . -name \*.go | while read a; do echo $(dirname $a)/"*.go"; done | sort | uniq | egrep -v "$IGNORE_PKGS" | sed "s|\./||g"` TESTABLE_AND_FORMATTABLE=`echo "$TEST_PKGS" | egrep -v "$INTEGRATION_PKGS"` +if [ -z "$GOARCH" ]; then + GOARCH=$(go env GOARCH); +fi + # user has not provided PKG override if [ -z "$PKG" ]; then TEST=$TESTABLE_AND_FORMATTABLE @@ -54,12 +58,7 @@ split=(${TEST// / }) TEST=${split[@]/#/${REPO_PATH}/} # determine whether target supports race detection -if [ -z "$GOARCH" ]; then - MACHINE_TYPE=$(uname -m) - if [ "$MACHINE_TYPE" == "x86_64" ]; then - RACE="--race" - fi -elif [ "$GOARCH" == "amd64" ]; then +if [ "$GOARCH" == "amd64" ]; then RACE="--race" fi @@ -89,15 +88,31 @@ function grpcproxy_pass { } function release_pass { + rm -f ./bin/etcd-last-release # to grab latest patch release; bump this up for every minor release UPGRADE_VER=$(git tag -l --sort=-version:refname "v3.0.*" | head -1) if [ -n "$MANUAL_VER" ]; then # in case, we need to test against different version UPGRADE_VER=$MANUAL_VER fi - echo "Downloading" etcd $UPGRADE_VER - curl -L https://github.com/coreos/etcd/releases/download/$UPGRADE_VER/etcd-$UPGRADE_VER-linux-amd64.tar.gz -o /tmp/etcd-$UPGRADE_VER-linux-amd64.tar.gz - tar xzvf /tmp/etcd-$UPGRADE_VER-linux-amd64.tar.gz -C /tmp/ --strip-components=1 + + local file="etcd-$UPGRADE_VER-linux-$GOARCH.tar.gz" + echo "Downloading $file" + + set +e + curl --fail -L https://github.com/coreos/etcd/releases/download/$UPGRADE_VER/$file -o /tmp/$file + local result=$? + set -e + case $result in + 0) ;; + 22) return 0 + ;; + *) exit $result + ;; + esac + + tar xzvf /tmp/$file -C /tmp/ --strip-components=1 + mkdir -p ./bin mv /tmp/etcd ./bin/etcd-last-release }