Skip to content

Commit 61ab69e

Browse files
fix(test-network): use CLI_DELAY fallback in ccutils.sh retry loops
1 parent bf7e75c commit 61ab69e

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

test-network/scripts/ccutils.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function checkCommitReadiness() {
5353
# continue to poll
5454
# we either get a successful response, or reach MAX RETRY
5555
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
56-
sleep $DELAY
57-
infoln "Attempting to check the commit readiness of the chaincode definition on peer0.org${ORG}, Retry after $DELAY seconds."
56+
sleep ${DELAY:-$CLI_DELAY}
57+
infoln "Attempting to check the commit readiness of the chaincode definition on peer0.org${ORG}, Retry after ${DELAY:-$CLI_DELAY} seconds."
5858
set -x
5959
peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name ${CC_NAME} --version ${CC_VERSION} --sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG} --output json >&log.txt
6060
res=$?
@@ -102,8 +102,8 @@ function queryCommitted() {
102102
# continue to poll
103103
# we either get a successful response, or reach MAX RETRY
104104
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
105-
sleep $DELAY
106-
infoln "Attempting to Query committed status on peer0.org${ORG}, Retry after $DELAY seconds."
105+
sleep ${DELAY:-$CLI_DELAY}
106+
infoln "Attempting to Query committed status on peer0.org${ORG}, Retry after ${DELAY:-$CLI_DELAY} seconds."
107107
set -x
108108
peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name ${CC_NAME} >&log.txt
109109
res=$?
@@ -131,7 +131,7 @@ function chaincodeInvokeInit() {
131131
# continue to poll
132132
# we either get a successful response, or reach MAX RETRY
133133
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
134-
sleep $DELAY
134+
sleep ${DELAY:-$CLI_DELAY}
135135
# while 'peer chaincode' command can get the orderer endpoint from the
136136
# peer (if join was successful), let's supply it directly as we know
137137
# it using the "-o" option
@@ -157,8 +157,8 @@ function chaincodeQuery() {
157157
# continue to poll
158158
# we either get a successful response, or reach MAX RETRY
159159
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
160-
sleep $DELAY
161-
infoln "Attempting to Query peer0.org${ORG}, Retry after $DELAY seconds."
160+
sleep ${DELAY:-$CLI_DELAY}
161+
infoln "Attempting to Query peer0.org${ORG}, Retry after ${DELAY:-$CLI_DELAY} seconds."
162162
set -x
163163
peer chaincode query -C $CHANNEL_NAME -n ${CC_NAME} -c '{"Args":["org.hyperledger.fabric:GetMetadata"]}' >&log.txt
164164
res=$?
@@ -299,8 +299,8 @@ chaincodeInvoke() {
299299
# continue to poll
300300
# we either get a successful response, or reach MAX RETRY
301301
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
302-
sleep $DELAY
303-
infoln "Attempting to Invoke on peer0.org${ORG}, Retry after $DELAY seconds."
302+
sleep ${DELAY:-$CLI_DELAY}
303+
infoln "Attempting to Invoke on peer0.org${ORG}, Retry after ${DELAY:-$CLI_DELAY} seconds."
304304
set -x
305305
peer chaincode invoke -o localhost:7050 -C $CHANNEL_NAME -n ${CC_NAME} -c ${CC_INVOKE_CONSTRUCTOR} --tls --cafile $ORDERER_CA --peerAddresses localhost:7051 --tlsRootCertFiles $PEER0_ORG1_CA --peerAddresses localhost:9051 --tlsRootCertFiles $PEER0_ORG2_CA >&log.txt
306306
res=$?
@@ -328,8 +328,8 @@ chaincodeQuery() {
328328
# continue to poll
329329
# we either get a successful response, or reach MAX RETRY
330330
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
331-
sleep $DELAY
332-
infoln "Attempting to Query peer0.org${ORG}, Retry after $DELAY seconds."
331+
sleep ${DELAY:-$CLI_DELAY}
332+
infoln "Attempting to Query peer0.org${ORG}, Retry after ${DELAY:-$CLI_DELAY} seconds."
333333
set -x
334334
peer chaincode query -C $CHANNEL_NAME -n ${CC_NAME} -c ${CC_QUERY_CONSTRUCTOR} >&log.txt
335335
res=$?

0 commit comments

Comments
 (0)