Skip to content

Commit

Permalink
Correctly exit on build errors from cirun.sh
Browse files Browse the repository at this point in the history
Change-Id: I6f9ca0a165c474e47e7da445fd741195c51661ca
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
  • Loading branch information
bestbeforetoday committed Sep 24, 2019
1 parent 8af3374 commit bc7a73d
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions src/test/cirun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#Start integration tests.
# expect WD env set HLJSDK directory.

set -eo pipefail

# unset ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS
# unset ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS
export ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=true
Expand Down Expand Up @@ -41,12 +43,12 @@ ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION:
ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION:-}

if [ -z $ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION ];then
dotcount="${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION//\.}"
if [ "3" == "${#dotcount}" ];then
export ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION%.*}
else
export ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION=$ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION
fi
dotcount="${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION//\.}"
if [ "3" == "${#dotcount}" ];then
export ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION%.*}
else
export ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION=$ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION
fi
fi

case "$ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION" in
Expand All @@ -61,37 +63,37 @@ case "$ORG_HYPERLEDGER_FABRIC_SDKTEST_FIXVERSION" in
# set which Fabric generated configuations is used.
export FAB_CONFIG_GEN_VERS="v1.0"
;;
"1.1" )
export IMAGE_TAG_FABRIC=:x86_64-1.1.1
export IMAGE_TAG_FABRIC_CA=:x86_64-1.1.1
export FAB_CONFIG_GEN_VERS="v1.1"
;;
"1.2" )
export IMAGE_TAG_FABRIC=:1.2.1
export IMAGE_TAG_FABRIC_CA=:1.2.1
export FAB_CONFIG_GEN_VERS="v1.2"
;;
"1.3" )
export IMAGE_TAG_FABRIC=:1.3.0
export IMAGE_TAG_FABRIC_CA=:1.3.0
export FAB_CONFIG_GEN_VERS="v1.3"
;;
"1.4" )
"1.1")
export IMAGE_TAG_FABRIC=:x86_64-1.1.1
export IMAGE_TAG_FABRIC_CA=:x86_64-1.1.1
export FAB_CONFIG_GEN_VERS="v1.1"
;;
"1.2")
export IMAGE_TAG_FABRIC=:1.2.1
export IMAGE_TAG_FABRIC_CA=:1.2.1
export FAB_CONFIG_GEN_VERS="v1.2"
;;
"1.3")
export IMAGE_TAG_FABRIC=:1.3.0
export IMAGE_TAG_FABRIC_CA=:1.3.0
export FAB_CONFIG_GEN_VERS="v1.3"
;;
"1.4")
export IMAGE_TAG_FABRIC=:1.4
export IMAGE_TAG_FABRIC_CA=:1.4
export FAB_CONFIG_GEN_VERS="v1.3" # not a copy/paste error :)
;;
*)
#export FAB_CONFIG_GEN_VERS="v1.3"
#export FAB_CONFIG_GEN_VERS="v1.3"
# cleans out an existing imgages...
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true

#everything just defaults for latest (v1.1)
#unset to use what's in docker's .env file.
unset IMAGE_TAG_FABRIC
unset IMAGE_TAG_FABRIC_CA
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true
#(docker images -qa | sort | uniq | xargs docker rmi -f) || true

#everything just defaults for latest (v1.1)
#unset to use what's in docker's .env file.
unset IMAGE_TAG_FABRIC
unset IMAGE_TAG_FABRIC_CA
;;
esac

Expand All @@ -106,19 +108,19 @@ echo "mvn version:--------------------"
mvn --version
echo "---------------------------------"

cd $WD/src/test/fixture/sdkintegration
cd "$WD/src/test/fixture/sdkintegration"
./fabric.sh restart >dockerlogfile.log 2>&1 &
sleep 5; #give it this much to start.

cd $WD
cd "$WD"

i=0

#wait till we get at least one peer started other should not be far behind.
until [ "`docker inspect -f {{.State.Running}} peer1.org2.example.com`" == "true" ] || [ $i -gt 60 ]; do
i=$((i + 1))
echo "Waiting.. $i"
sleep 10;
until [ "`docker inspect -f {{.State.Running}} peer1.org2.example.com`" == "true" ] || [ $i -gt 60 ]; do
i=$((i + 1))
echo "Waiting.. $i"
sleep 10;
done;

sleep 15 # some more time just for the other services .. this should be overkill.
Expand Down

0 comments on commit bc7a73d

Please sign in to comment.