Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure tests wait for microfab to start #365

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,50 @@ docker run --name microfab \
-e MICROFAB_CONFIG="${MICROFAB_CONFIG}" \
-e FABRIC_LOGGING_SPEC=info \
ghcr.io/hyperledger-labs/microfab
timeout 60s bash -c 'docker logs -f microfab | grep --max-count=1 "Microfab started"'


sleep 10

curl -sSL http://console.localho.st:8080/ak/api/v1/components > $CFG/cfg.json
curl -sSL http://console.localho.st:8080/ak/api/v1/components > $CFG/cfg.json
npx @hyperledger-labs/weft microfab -w $CFG/_wallets -p $CFG/_gateways -m $CFG/_msp -f --config $CFG/cfg.json

# bring in the helper bash scripts
. $DIR/scripts/ccutils.sh


function deployCC() {
## package the chaincode
packageChaincode
## package the chaincode
packageChaincode

## Install chaincode on peer0.org1 and peer0.org2
infoln "Installing chaincode on peer0.org1..."
installChaincode 1
infoln "Install chaincode on peer0.org2..."
installChaincode 2
## Install chaincode on peer0.org1 and peer0.org2
infoln "Installing chaincode on peer0.org1..."
installChaincode 1
infoln "Install chaincode on peer0.org2..."
installChaincode 2

## query whether the chaincode is installed
queryInstalled 1
## query whether the chaincode is installed
queryInstalled 1

## approve the definition for org1
approveForMyOrg 1
## approve the definition for org1
approveForMyOrg 1

## check whether the chaincode definition is ready to be committed
## expect org1 to have approved and org2 not to
checkCommitReadiness 1 "\"org1MSP\": true" "\"org2MSP\": false"
checkCommitReadiness 2 "\"org1MSP\": true" "\"org2MSP\": false"
## check whether the chaincode definition is ready to be committed
## expect org1 to have approved and org2 not to
checkCommitReadiness 1 "\"org1MSP\": true" "\"org2MSP\": false"
checkCommitReadiness 2 "\"org1MSP\": true" "\"org2MSP\": false"

## now approve also for org2
approveForMyOrg 2
## now approve also for org2
approveForMyOrg 2

## check whether the chaincode definition is ready to be committed
## expect them both to have approved
checkCommitReadiness 1 "\"org1MSP\": true" "\"org2MSP\": true"
checkCommitReadiness 2 "\"org1MSP\": true" "\"org2MSP\": true"
## check whether the chaincode definition is ready to be committed
## expect them both to have approved
checkCommitReadiness 1 "\"org1MSP\": true" "\"org2MSP\": true"
checkCommitReadiness 2 "\"org1MSP\": true" "\"org2MSP\": true"

## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition 1 2
## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition 1 2

## query on both orgs to see that the definition committed successfully
queryCommitted 1
queryCommitted 2
## query on both orgs to see that the definition committed successfully
queryCommitted 1
queryCommitted 2
}
#./gradlew -I ./chaincode-init.gradle -PchaincodeRepoDir=$(realpath ./fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/repository) publishShimPublicationToFabricRepository

Expand Down