[FAB-15897] Improve FabCar test logging

Collect logs from all existing Docker containers instead
of just limiting it to a predefined (and incorrect) set.

Also clean up the directory structure for the logs, and
remove any networks/volumes after each test run.

Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
Change-Id: Ifcf88baeb9ba4d42f757f7cd23ab2a178ab39b41
This commit is contained in:
Simon Stone 2019-07-25 09:32:08 +01:00
parent dd8150abf3
commit abbda9575f
2 changed files with 24 additions and 16 deletions

View file

@ -174,7 +174,7 @@ ${PEER0_ORG1} lifecycle chaincode commit \
--tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE}
echo "Submitting initLedger transaction to smart contract on mychannel"
echo "The transaction is sent to all of the peers so that chaincode is built before receiving the following requests"
# echo "The transaction is sent to all of the peers so that chaincode is built before receiving the following requests"
${PEER0_ORG1} chaincode invoke \
-C mychannel \
-n fabcar \
@ -182,12 +182,23 @@ ${PEER0_ORG1} chaincode invoke \
--waitForEvent \
--waitForEventTimeout 300s \
--peerAddresses peer0.org1.example.com:7051 \
--peerAddresses peer1.org1.example.com:8051 \
--peerAddresses peer0.org2.example.com:9051 \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
--tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE}
# Temporary workaround (see FAB-15897) - cannot invoke across all four peers at the same time, so use a query to build
# the chaincode across the remaining peers.
${PEER1_ORG1} chaincode query \
-C mychannel \
-n fabcar \
-c '{"function":"queryAllCars","Args":[]}' \
--peerAddresses peer1.org1.example.com:8051 \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE}
${PEER1_ORG2} chaincode query \
-C mychannel \
-n fabcar \
-c '{"function":"queryAllCars","Args":[]}' \
--peerAddresses peer1.org2.example.com:10051 \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
--tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} \
--tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE}
cat <<EOF

View file

@ -3,18 +3,13 @@
# SPDX-License-Identifier: Apache-2.0
#
# docker container list - Check these from basic-network/docker-compose.yaml
CONTAINER_LIST=(peer0.org1 orderer ca)
logs() {
for CONTAINER in ${CONTAINER_LIST[*]}; do
docker logs $CONTAINER.example.com >& $WORKSPACE/$CONTAINER-$1.log
echo
done
# Write couchdb container logs into couchdb.log file
docker logs couchdb >& couchdb.log
LOG_DIRECTORY=$WORKSPACE/fabcar/$1
mkdir -p ${LOG_DIRECTORY}
CONTAINER_LIST=$(docker ps -a --format '{{.Names}}')
for CONTAINER in ${CONTAINER_LIST}; do
docker logs ${CONTAINER} > ${LOG_DIRECTORY}/${CONTAINER}.log 2>&1
done
}
copy_logs() {
@ -65,5 +60,7 @@ for LANGUAGE in ${LANGUAGES}; do
fi
docker ps -aq | xargs docker rm -f
docker rmi -f $(docker images -aq dev-*)
docker volume prune -f
docker network prune -f
echo -e "\033[32m finished fabcar test (${LANGUAGE})" "\033[0m"
done