From 92cb79d9db2c95df56b18e930c4e695f935362cf Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 28 Nov 2024 00:53:11 +0000 Subject: [PATCH] Fix build with new microfab release The new microfab release seems to start slower than the previous release. This might be due to a change from solo to raft consensus. This causes failures in the full-stack-asset-transfer appdev tests. Chaincode deployment fails since the channel is not yet available. Instead of increasing the sleep time after launching microfab, this change attempts to wait however long is required by looking for the "Microfab started" message in the container log before proceeding. The test script is also updated to correctly stop the external chaincode process when the script exits. Previously the process ID of the npm command used to lauch the chaincode was captured rather than the actual chaincode process. Signed-off-by: Mark S. Lewis --- full-stack-asset-transfer-guide/justfile | 7 ++++--- full-stack-asset-transfer-guide/tests/10-appdev-e2e.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/full-stack-asset-transfer-guide/justfile b/full-stack-asset-transfer-guide/justfile index a9e1edcb74..c3ba63aec9 100644 --- a/full-stack-asset-transfer-guide/justfile +++ b/full-stack-asset-transfer-guide/justfile @@ -168,15 +168,16 @@ microfab: microfab-down } ], - "capability_level":"V2_0" + "capability_level":"V2_5" }' mkdir -p $CFG echo echo "Stating microfab...." - docker run --name microfab -p 8080:8080 --add-host host.docker.internal:host-gateway --rm -d -e MICROFAB_CONFIG="${MICROFAB_CONFIG}" ghcr.io/hyperledger-labs/microfab:latest - sleep 5 + timeout 60s bash -c \ + 'docker run --name microfab -p 8080:8080 --add-host host.docker.internal:host-gateway --rm -d -e MICROFAB_CONFIG="${MICROFAB_CONFIG}" ghcr.io/hyperledger-labs/microfab:latest \ + && docker logs -f microfab | grep --max-count=1 "Microfab started"' curl -s http://console.127-0-0-1.nip.io:8080/ak/api/v1/components | weft microfab -w $CFG/_wallets -p $CFG/_gateways -m $CFG/_msp -f cat << EOF > $CFG/org1admin.env diff --git a/full-stack-asset-transfer-guide/tests/10-appdev-e2e.sh b/full-stack-asset-transfer-guide/tests/10-appdev-e2e.sh index eec1baadfd..6a38f5c212 100755 --- a/full-stack-asset-transfer-guide/tests/10-appdev-e2e.sh +++ b/full-stack-asset-transfer-guide/tests/10-appdev-e2e.sh @@ -36,7 +36,7 @@ source "${WORKSHOP_PATH}/_cfg/uf/org1admin.env" cd "${WORKSHOP_PATH}/contracts/asset-transfer-typescript" npm install npm run build -npm run start:server-nontls & +node_modules/.bin/fabric-chaincode-node server --chaincode-address="${CHAINCODE_SERVER_ADDRESS}" --chaincode-id="${CHAINCODE_ID}" & CHAINCODE_PID=$! sleep 5