diff --git a/packages/caliper-tests-integration/fabric_tests/.gitignore b/packages/caliper-tests-integration/fabric_tests/.gitignore index 73806d919..e018c337a 100644 --- a/packages/caliper-tests-integration/fabric_tests/.gitignore +++ b/packages/caliper-tests-integration/fabric_tests/.gitignore @@ -1,3 +1,8 @@ **/*.log +*.tgz +_cfg +bin +config +package-lock.json report.html fabric-samples diff --git a/packages/caliper-tests-integration/fabric_tests/init.js b/packages/caliper-tests-integration/fabric_tests/init.js index 8037f8795..68aca5bfb 100644 --- a/packages/caliper-tests-integration/fabric_tests/init.js +++ b/packages/caliper-tests-integration/fabric_tests/init.js @@ -64,7 +64,7 @@ class MarblesInitWorkload extends WorkloadModuleBase { contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractFunction: 'initMarble', contractArguments: [marbleName, marbleColor, marbleSize, marbleOwner], - invokerIdentity: 'client0.org1.example.com', + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', timeout: 5, readOnly: false }; diff --git a/packages/caliper-tests-integration/fabric_tests/initByChannel.js b/packages/caliper-tests-integration/fabric_tests/initByChannel.js index 26ba1b5df..ce06d25d8 100644 --- a/packages/caliper-tests-integration/fabric_tests/initByChannel.js +++ b/packages/caliper-tests-integration/fabric_tests/initByChannel.js @@ -64,10 +64,10 @@ class MarblesInitByChannelWorkload extends WorkloadModuleBase { contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractVersion: 'v0', contractFunction: 'initMarble', - invokerIdentity: 'client0.org1.example.com', + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', contractArguments: [marbleName, marbleColor, marbleSize, marbleOwner], - timeout: 5, + timeout: 10, readOnly: false }; diff --git a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml index 95af81d2e..09cf649ad 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml @@ -25,47 +25,41 @@ organizations: Org1: mspid: Org1MSP peers: - - peer0.org1.example.com + - org1peer-api.127-0-0-1.nip.io:8080 orderers: - orderer.example.com: - url: grpcs://localhost:7050 + orderer-api.127-0-0-1.nip.io:8080: + url: grpc://orderer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: orderer.example.com - tlsCACerts: - path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + ssl-target-name-override: orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 + org1peer-api.127-0-0-1.nip.io:8080: + url: grpc://org1peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org1.example.com + ssl-target-name-override: org1peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - peer0.org2.example.com: - url: grpcs://localhost:9051 + org2peer-api.127-0-0-1.nip.io:8080: + url: grpc://org2peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org2.example.com + ssl-target-name-override: org2peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem channels: mychannel: orderers: - - orderer.example.com + - orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: + org1peer-api.127-0-0-1.nip.io:8080: eventSource: true - peer0.org2.example.com: + org2peer-api.127-0-0-1.nip.io:8080: eventSource: true yourchannel: orderers: - - orderer.example.com + - orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: + org1peer-api.127-0-0-1.nip.io:8080: eventSource: true - peer0.org2.example.com: + org2peer-api.127-0-0-1.nip.io:8080: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml index f15774bee..5347a2080 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml @@ -25,47 +25,41 @@ organizations: Org2: mspid: Org2MSP peers: - - peer0.org2.example.com + - org2peer-api.127-0-0-1.nip.io:8080 orderers: - orderer.example.com: - url: grpcs://localhost:7050 + orderer-api.127-0-0-1.nip.io:8080: + url: grpc://orderer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: orderer.example.com - tlsCACerts: - path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + ssl-target-name-override: orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 + org1peer-api.127-0-0-1.nip.io:8080: + url: grpc://org1peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org1.example.com + ssl-target-name-override: org1peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - peer0.org2.example.com: - url: grpcs://localhost:9051 + org2peer-api.127-0-0-1.nip.io:8080: + url: grpc://org2peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org2.example.com + ssl-target-name-override: org2peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem channels: mychannel: orderers: - - orderer.example.com + - orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: + org1peer-api.127-0-0-1.nip.io:8080: eventSource: true - peer0.org2.example.com: + org2peer-api.127-0-0-1.nip.io:8080: eventSource: true yourchannel: orderers: - - orderer.example.com + - orderer-api.127-0-0-1.nip.io:8080 peers: - peer0.org1.example.com: + org1peer-api.127-0-0-1.nip.io:8080: eventSource: true - peer0.org2.example.com: + org2peer-api.127-0-0-1.nip.io:8080: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml index 5d0170a56..41533b23d 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml @@ -32,11 +32,11 @@ organizations: - mspid: Org1MSP identities: certificates: - - name: 'client0.org1.example.com' + - name: 'client0.org1.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/signcerts/org1admin.pem' connectionProfile: path: './ccp-org1.yaml' discover: false @@ -44,11 +44,11 @@ organizations: - mspid: Org2MSP identities: certificates: - - name: 'client0.org2.example.com' + - name: 'client0.org2.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/signcerts/org2admin.pem' connectionProfile: path: './ccp-org2.yaml' discover: false diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml index 2caf26800..1d11c76d1 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml @@ -74,4 +74,4 @@ monitors: - module: docker options: interval: 4 - containers: ['peer0.org1.example.com', 'peer0.org2.example.com', 'orderer0.example.com', 'orderer1.example.com'] + containers: ['org1peer-api.127-0-0-1.nip.io:8080', 'org2peer-api.127-0-0-1.nip.io:8080', 'orderer-api.127-0-0-1.nip.io:8080'] diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml index 91368cf86..b396cff13 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml @@ -32,23 +32,23 @@ organizations: - mspid: Org1MSP identities: certificates: - - name: 'client0.org1.example.com' + - name: 'client0.org1.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/signcerts/org1admin.pem' connectionProfile: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml' + path: '../_cfg/uf/_gateways/org1gateway.json' discover: true - mspid: Org2MSP identities: certificates: - - name: 'client0.org2.example.com' + - name: 'client0.org2.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/signcerts/org2admin.pem' connectionProfile: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml' + path: '../_cfg/uf/_gateways/org2gateway.json' discover: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml index 91368cf86..b396cff13 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml @@ -32,23 +32,23 @@ organizations: - mspid: Org1MSP identities: certificates: - - name: 'client0.org1.example.com' + - name: 'client0.org1.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/signcerts/org1admin.pem' connectionProfile: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml' + path: '../_cfg/uf/_gateways/org1gateway.json' discover: true - mspid: Org2MSP identities: certificates: - - name: 'client0.org2.example.com' + - name: 'client0.org2.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/signcerts/org2admin.pem' connectionProfile: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml' + path: '../_cfg/uf/_gateways/org2gateway.json' discover: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml index 17362faa3..7e398c4cd 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml @@ -77,5 +77,5 @@ monitors: - module: docker options: interval: 4 - containers: ['peer0.org1.example.com', 'peer0.org2.example.com', 'orderer0.example.com', 'orderer1.example.com'] + containers: ['org1peer-api.127-0-0-1.nip.io:8080', 'org2peer-api.127-0-0-1.nip.io:8080', 'orderer-api.127-0-0-1.nip.io:8080'] diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml index deb7fec91..f497baceb 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml @@ -32,31 +32,27 @@ organizations: - mspid: Org1MSP identities: certificates: - - name: 'client0.org1.example.com' + - name: 'client0.org1.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org1/org1admin/msp/signcerts/org1admin.pem' peers: - - endpoint: localhost:7051 + - endpoint: org1peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org1.example.com + ssl-target-name-override: org1peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - mspid: Org2MSP identities: certificates: - - name: 'client0.org2.example.com' + - name: 'client0.org2.127-0-0-1.nip.io:8080' clientPrivateKey: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/keystore/cert_sk' clientSignedCert: - path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' + path: '../_cfg/uf/_msp/Org2/org2admin/msp/signcerts/org2admin.pem' peers: - - endpoint: localhost:9051 + - endpoint: org1peer-api.127-0-0-1.nip.io:8080 grpcOptions: - ssl-target-name-override: peer0.org2.example.com + ssl-target-name-override: org1peer-api.127-0-0-1.nip.io grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js index 0124fc789..5f857b0cc 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js +++ b/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js @@ -43,7 +43,7 @@ class MarblesQueryByChannelWorkload extends WorkloadModuleBase { channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', contractFunction: 'queryMarblesByOwner', contractArguments: [marbleOwner], - invokerIdentity: 'client0.org1.example.com', + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', timeout: 10 }; diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js index 5565a7eac..eaa2ae6e1 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js +++ b/packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js @@ -41,7 +41,7 @@ class MarblesQueryWorkload extends WorkloadModuleBase { contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractFunction: 'queryMarblesByOwner', contractArguments: [marbleOwner], - invokerIdentity: 'client0.org1.example.com', + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', timeout: 10 }; diff --git a/packages/caliper-tests-integration/fabric_tests/query.js b/packages/caliper-tests-integration/fabric_tests/query.js index 9ecfa2abb..1838824ff 100644 --- a/packages/caliper-tests-integration/fabric_tests/query.js +++ b/packages/caliper-tests-integration/fabric_tests/query.js @@ -41,9 +41,8 @@ class MarblesQueryWorkload extends WorkloadModuleBase { contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractFunction: 'queryMarblesByOwner', contractArguments: [marbleOwner], - invokerIdentity: 'client0.org1.example.com', - targetPeers: ['peer0.org1.example.com'], - timeout: 10 + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', + timeout: 10, }; await this.sutAdapter.sendRequests(args); diff --git a/packages/caliper-tests-integration/fabric_tests/queryByChannel.js b/packages/caliper-tests-integration/fabric_tests/queryByChannel.js index 74a59aec1..5f857b0cc 100644 --- a/packages/caliper-tests-integration/fabric_tests/queryByChannel.js +++ b/packages/caliper-tests-integration/fabric_tests/queryByChannel.js @@ -43,8 +43,7 @@ class MarblesQueryByChannelWorkload extends WorkloadModuleBase { channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', contractFunction: 'queryMarblesByOwner', contractArguments: [marbleOwner], - invokerIdentity: 'client0.org1.example.com', - targetPeers: ['peer0.org1.example.com'], + invokerIdentity: 'client0.org1.127-0-0-1.nip.io:8080', timeout: 10 }; diff --git a/packages/caliper-tests-integration/fabric_tests/run.sh b/packages/caliper-tests-integration/fabric_tests/run.sh index c38179187..e54d26c94 100755 --- a/packages/caliper-tests-integration/fabric_tests/run.sh +++ b/packages/caliper-tests-integration/fabric_tests/run.sh @@ -20,12 +20,112 @@ set -v DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "${DIR}" -if [[ ! -d "fabric-samples" ]]; then - curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +if [[ ! -d "bin" || ! -d "config" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 -d -s fi -# back to this dir -cd ${DIR} +npm install -g @hyperledger-labs/weft + +export PATH=${DIR}/bin:$PATH + +export MICROFAB_CONFIG='{ + "ordering_organizations": { + "name": "Orderer" + }, + "endorsing_organizations":[ + { + "name": "Org1" + }, + { + "name": "Org2" + } + ], + "channels":[ + { + "name": "mychannel", + "endorsing_organizations":[ + "Org1", + "Org2" + ] + }, + { + "name": "yourchannel", + "endorsing_organizations":[ + "Org1", + "Org2" + ] + } + ] +}' +export CHAINCODE_NAME="marbles" + +export CFG=$DIR/_cfg/uf +rm -rf $CFG +mkdir -p $CFG + +docker run --name microfab -p 8080:8080 --add-host host.docker.internal:host-gateway --rm -d -e MICROFAB_CONFIG="${MICROFAB_CONFIG}" ibmcom/ibp-microfab:0.0.16 +sleep 5 + +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 + +export CORE_PEER_LOCALMSPID=Org1MSP +export CORE_PEER_MSPCONFIGPATH=$CFG/_msp/Org1/org1admin/msp +export CORE_PEER_ADDRESS=org1peer-api.127-0-0-1.nip.io:8080 +export FABRIC_CFG_PATH=$DIR/config +export CORE_PEER_CLIENT_CONNTIMEOUT=15s +export CORE_PEER_DELIVERYCLIENT_CONNTIMEOUT=15s + +pushd $DIR/src/${CHAINCODE_NAME}/node + +export CHAINCODE_SERVER_ADDRESS=host.docker.internal:9999 +export CHAINCODE_ID=$(weft chaincode package caas --path . --label ${CHAINCODE_NAME} --address ${CHAINCODE_SERVER_ADDRESS} --archive ${CHAINCODE_NAME}.tgz --quiet) +echo "Chaincode ID: ${CHAINCODE_ID}" + +peer lifecycle chaincode install ${CHAINCODE_NAME}.tgz + +export CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 + +npm install +npm run start & + +peer lifecycle chaincode approveformyorg --channelID mychannel --name mymarbles -v v0 --package-id $CHAINCODE_ID --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" +peer lifecycle chaincode approveformyorg --channelID yourchannel --name yourmarbles -v v0 --package-id $CHAINCODE_ID --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" + +export CORE_PEER_LOCALMSPID=Org2MSP +export CORE_PEER_MSPCONFIGPATH=$CFG/_msp/Org2/org2admin/msp +export CORE_PEER_ADDRESS=org2peer-api.127-0-0-1.nip.io:8080 + +peer lifecycle chaincode install ${CHAINCODE_NAME}.tgz + +peer lifecycle chaincode approveformyorg --channelID mychannel --name mymarbles -v v0 --package-id $CHAINCODE_ID --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" +peer lifecycle chaincode approveformyorg --channelID yourchannel --name yourmarbles -v v0 --package-id $CHAINCODE_ID --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" + +peer lifecycle chaincode commit --channelID mychannel --name mymarbles -v v0 --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" +peer lifecycle chaincode querycommitted --channelID=mychannel + +peer lifecycle chaincode commit --channelID yourchannel --name yourmarbles -v v0 --sequence 1 --connTimeout 15s --signature-policy "OR('Org1MSP.member','Org2MSP.member')" +peer lifecycle chaincode querycommitted --channelID=yourchannel + +popd + +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 + +dispose () { + JOBS=$(jobs -p) + if [ -n "$JOBS" ]; then + echo "Killing jobs: $JOBS" + kill $JOBS + fi + docker ps -a + docker logs microfab > /tmp/microfab.log + docker stop microfab + ${CALL_METHOD} launch manager --caliper-workspace phase6 --caliper-flow-only-end +} + +trap 'dispose' EXIT + +# change default settings (add config paths too) +export CALIPER_PROJECTCONFIG=../caliper.yaml # bind during CI tests, using the package dir as CWD # Note: do not use env variables for binding settings, as subsequent launch calls will pick them up and bind again @@ -35,35 +135,17 @@ export NODE_PATH="$SUT_DIR/cached/v$FABRIC_VERSION/node_modules" if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then mkdir -p $SUT_DIR/cached/v$FABRIC_VERSION pushd $SUT_DIR/cached/v$FABRIC_VERSION - ${CALL_METHOD} bind --caliper-bind-sut fabric:$FABRIC_VERSION + ${CALL_METHOD} bind \ + --caliper-bind-sut fabric:$FABRIC_VERSION \ + --caliper-bind-args="--prefix $SUT_DIR/cached/v$FABRIC_VERSION" popd fi -# change default settings (add config paths too) -export CALIPER_PROJECTCONFIG=../caliper.yaml - -dispose () { - docker ps -a - ${CALL_METHOD} launch manager --caliper-workspace phase6 --caliper-flow-only-end -} - -TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network - -# Create Fabric network -pushd ${TEST_NETWORK_DIR} -./network.sh up -s couchdb -./network.sh createChannel -c mychannel -./network.sh createChannel -c yourchannel -./network.sh deployCC -ccn mymarbles -c mychannel -ccp ${DIR}/src/marbles/node -ccl javascript -ccv v0 -ccep "OR('Org1MSP.member','Org2MSP.member')" -./network.sh deployCC -ccn yourmarbles -c yourchannel -ccp ${DIR}/src/marbles/node -ccl javascript -ccv v0 -ccep "OR('Org1MSP.member','Org2MSP.member')" -popd - # PHASE 1: just starting the network ${CALL_METHOD} launch manager --caliper-workspace phase1 --caliper-flow-only-start rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 1"; - dispose; exit ${rc}; fi @@ -72,7 +154,6 @@ ${CALL_METHOD} launch manager --caliper-workspace phase2 --caliper-flow-only-tes rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 2"; - dispose; exit ${rc}; fi @@ -81,7 +162,6 @@ ${CALL_METHOD} launch manager --caliper-workspace phase3 --caliper-flow-only-tes rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 3"; - dispose; exit ${rc}; fi @@ -102,7 +182,6 @@ ${CALL_METHOD} launch manager --caliper-workspace phase4 --caliper-flow-only-tes rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 4"; - dispose; exit ${rc}; fi @@ -123,7 +202,6 @@ ${CALL_METHOD} launch manager --caliper-workspace phase5 --caliper-flow-only-tes rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 5"; - dispose; exit ${rc}; fi @@ -134,8 +212,3 @@ if [[ ${rc} != 0 ]]; then echo "Failed CI step 6"; exit ${rc}; fi - -# Cleanup Fabric network -pushd ${TEST_NETWORK_DIR} -./network.sh down -popd diff --git a/packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js b/packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js index f36228a19..222071cfd 100644 --- a/packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js +++ b/packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js @@ -506,4 +506,9 @@ let Chaincode = class { } }; -shim.start(new Chaincode()); +const server = shim.server(new Chaincode(), { + ccid: process.env.CHAINCODE_ID, + address: process.env.CHAINCODE_SERVER_ADDRESS, +}); + +server.start();