diff --git a/src/test/cirun.sh b/src/test/cirun.sh index 62f8ef10..1f8c1a19 100755 --- a/src/test/cirun.sh +++ b/src/test/cirun.sh @@ -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 @@ -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 @@ -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 @@ -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.