From 5025d20bb0f4fc70a42b015f4eb3981a02601249 Mon Sep 17 00:00:00 2001 From: Rinish Sam <36656347+CaptainIRS@users.noreply.github.com> Date: Wed, 20 Jul 2022 22:27:12 +0530 Subject: [PATCH] Migrate Fabric integration tests to test network (#1410) * Migrate Fabric integration tests to test network Signed-off-by: CaptainIRS <36656347+CaptainIRS@users.noreply.github.com> * Address review comments * Get rid of `rm -fr /tmp/hfc-*` * Merge redundant phases * Upgrade SUT version in docker tests * Remove unnecessary connection profiles * Made `discover = true` Signed-off-by: CaptainIRS <36656347+CaptainIRS@users.noreply.github.com> * Address review comments * Add connection profiles wherever needed Signed-off-by: CaptainIRS <36656347+CaptainIRS@users.noreply.github.com> --- .../.gitignore | 1 + .../caliper.yaml | 2 +- .../ccp-org1.yaml | 28 +- .../ccp-org2.yaml | 28 +- .../fabric_docker_distributed_tests/clean.sh | 11 +- .../config/.gitignore | 5 - .../config/configtx.yaml | 92 ------- .../config/crypto-config.yaml | 36 --- .../config/generate.sh | 20 -- .../docker-compose.yaml | 250 +---------------- .../networkconfig.yaml | 174 +++--------- .../run-with-build.sh | 19 +- .../run-without-build.sh | 18 +- .../src/marbles/node/package.json | 2 +- .../fabric_docker_local_tests/.gitignore | 1 + .../fabric_docker_local_tests/caliper.yaml | 2 +- .../ccp-org1.yaml | 28 +- .../ccp-org2.yaml | 28 +- .../fabric_docker_local_tests/clean.sh | 11 +- .../config/.gitignore | 5 - .../config/configtx.yaml | 92 ------- .../config/crypto-config.yaml | 36 --- .../config/generate.sh | 20 -- .../docker-compose.yaml | 249 +---------------- .../networkconfig.yaml | 174 +++--------- .../run-with-build.sh | 19 +- .../run-without-build.sh | 19 +- .../src/marbles/node/package.json | 2 +- .../fabric_tests/.gitignore | 1 + .../fabric_tests/config/.gitignore | 5 - .../fabric_tests/config/configtx.yaml | 92 ------- .../fabric_tests/config/crypto-config.yaml | 36 --- .../fabric_tests/config/generate.sh | 20 -- .../fabric_tests/docker-compose.yaml | 257 +----------------- .../fabric_tests/initByChannel.js | 2 +- .../fabric_tests/phase1/networkconfig.yaml | 2 +- .../fabric_tests/phase2/benchconfig.yaml | 63 ++++- .../fabric_tests/phase2/ccp-org1.yaml | 24 +- .../fabric_tests/phase2/ccp-org2.yaml | 24 +- .../fabric_tests/phase2/networkconfig.yaml | 30 +- .../fabric_tests/phase3/benchconfig.yaml | 59 +++- .../fabric_tests/phase3/ccp-org1.yaml | 79 ------ .../fabric_tests/phase3/networkconfig.yaml | 40 +-- .../fabric_tests/phase4/benchconfig.yaml | 13 +- .../fabric_tests/phase4/networkconfig.yaml | 23 +- .../fabric_tests/phase5/benchconfig.yaml | 38 +-- .../fabric_tests/phase5/ccp-org2.yaml | 79 ------ .../fabric_tests/phase5/networkconfig.yaml | 35 ++- .../queryByChannelNoTargetPeers.js | 2 +- .../{phase7 => phase5}/queryNoTargetPeers.js | 0 .../fabric_tests/phase6/benchconfig.yaml | 52 +--- .../fabric_tests/phase6/ccp-org1.yaml | 79 ------ .../fabric_tests/phase6/ccp-org2.yaml | 79 ------ .../fabric_tests/phase6/networkconfig.yaml | 40 +-- .../fabric_tests/phase7/benchconfig.yaml | 81 ------ .../fabric_tests/phase7/networkconfig.yaml | 66 ----- .../fabric_tests/phase8/benchconfig.yaml | 38 --- .../fabric_tests/phase8/networkconfig.yaml | 21 -- .../fabric_tests/queryByChannel.js | 2 +- .../fabric_tests/run.sh | 76 +++--- .../{phase3 => }/src/marbles/go/marbles.go | 0 .../statedb/couchdb/indexes/indexOwner.json | 0 .../{phase3 => }/src/marbles/node/marbles.js | 0 .../statedb/couchdb/indexes/indexOwner.json | 0 .../src/marbles/node/package.json | 0 65 files changed, 434 insertions(+), 2396 deletions(-) rename packages/caliper-tests-integration/{fabric_tests/phase5 => fabric_docker_distributed_tests}/ccp-org1.yaml (59%) rename packages/caliper-tests-integration/{fabric_tests/phase3 => fabric_docker_distributed_tests}/ccp-org2.yaml (59%) delete mode 100644 packages/caliper-tests-integration/fabric_docker_distributed_tests/config/.gitignore delete mode 100644 packages/caliper-tests-integration/fabric_docker_distributed_tests/config/configtx.yaml delete mode 100644 packages/caliper-tests-integration/fabric_docker_distributed_tests/config/crypto-config.yaml delete mode 100755 packages/caliper-tests-integration/fabric_docker_distributed_tests/config/generate.sh rename packages/caliper-tests-integration/{fabric_tests/phase4 => fabric_docker_local_tests}/ccp-org1.yaml (59%) rename packages/caliper-tests-integration/{fabric_tests/phase4 => fabric_docker_local_tests}/ccp-org2.yaml (59%) delete mode 100644 packages/caliper-tests-integration/fabric_docker_local_tests/config/.gitignore delete mode 100644 packages/caliper-tests-integration/fabric_docker_local_tests/config/configtx.yaml delete mode 100644 packages/caliper-tests-integration/fabric_docker_local_tests/config/crypto-config.yaml delete mode 100755 packages/caliper-tests-integration/fabric_docker_local_tests/config/generate.sh delete mode 100644 packages/caliper-tests-integration/fabric_tests/config/.gitignore delete mode 100644 packages/caliper-tests-integration/fabric_tests/config/configtx.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/config/crypto-config.yaml delete mode 100755 packages/caliper-tests-integration/fabric_tests/config/generate.sh delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase3/ccp-org1.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase5/ccp-org2.yaml rename packages/caliper-tests-integration/fabric_tests/{phase7 => phase5}/queryByChannelNoTargetPeers.js (95%) rename packages/caliper-tests-integration/fabric_tests/{phase7 => phase5}/queryNoTargetPeers.js (100%) delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase6/ccp-org1.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase6/ccp-org2.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml delete mode 100644 packages/caliper-tests-integration/fabric_tests/phase8/networkconfig.yaml rename packages/caliper-tests-integration/fabric_tests/{phase3 => }/src/marbles/go/marbles.go (100%) rename packages/caliper-tests-integration/fabric_tests/{phase3 => }/src/marbles/go/metadata/statedb/couchdb/indexes/indexOwner.json (100%) rename packages/caliper-tests-integration/fabric_tests/{phase3 => }/src/marbles/node/marbles.js (100%) rename packages/caliper-tests-integration/fabric_tests/{phase3 => }/src/marbles/node/metadata/statedb/couchdb/indexes/indexOwner.json (100%) rename packages/caliper-tests-integration/fabric_tests/{phase3 => }/src/marbles/node/package.json (100%) diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/.gitignore b/packages/caliper-tests-integration/fabric_docker_distributed_tests/.gitignore index c9216fbdd..f44eb31f6 100644 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/.gitignore +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/.gitignore @@ -2,3 +2,4 @@ report.html node_modules/* package-lock.json +fabric-samples diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/caliper.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/caliper.yaml index cdffc5daf..fc5ecf854 100644 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/caliper.yaml +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/caliper.yaml @@ -16,7 +16,7 @@ caliper: benchconfig: ./benchconfig.yaml networkconfig: ./networkconfig.yaml bind: - sut: fabric:1.4.1 + sut: fabric:2.4 report: path: ./report.html logging: diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org1.yaml similarity index 59% rename from packages/caliper-tests-integration/fabric_tests/phase5/ccp-org1.yaml rename to packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org1.yaml index 05bbc5e6b..fa5daf049 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/ccp-org1.yaml +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org1.yaml @@ -28,41 +28,34 @@ organizations: - peer0.org1.example.com orderers: - orderer0.example.com: - url: grpcs://localhost:7050 + orderer.example.com: + url: grpcs://orderer.example.com:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: - url: grpcs://localhost:7051 + url: grpcs://peer0.org1.example.com:7051 grpcOptions: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://peer0.org2.example.com:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org2.yaml similarity index 59% rename from packages/caliper-tests-integration/fabric_tests/phase3/ccp-org2.yaml rename to packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org2.yaml index f8019837e..fdb377fe3 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/ccp-org2.yaml +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/ccp-org2.yaml @@ -28,41 +28,34 @@ organizations: - peer0.org2.example.com orderers: - orderer0.example.com: - url: grpcs://localhost:7050 + orderer.example.com: + url: grpcs://orderer.example.com:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: - url: grpcs://localhost:7051 + url: grpcs://peer0.org1.example.com:7051 grpcOptions: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://peer0.org2.example.com:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/clean.sh b/packages/caliper-tests-integration/fabric_docker_distributed_tests/clean.sh index 0cf43d427..38f33ec9d 100755 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/clean.sh +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/clean.sh @@ -16,7 +16,14 @@ # Print all commands. set -v +# Grab the parent (fabric_tests) directory. +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + +cd ${DIR} + docker-compose -p caliper down -(test -z \"$(docker ps -aq)\") || docker rm $(docker ps -aq) -(test -z \"$(docker images dev* -q)\") || docker rmi $(docker images dev* -q) +pushd ${TEST_NETWORK_DIR} +./network.sh down +popd diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/.gitignore b/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/.gitignore deleted file mode 100644 index 2bc6f264d..000000000 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bin/* -config/* -crypto-config/* -genesis.block -mychannel.tx diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/configtx.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/configtx.yaml deleted file mode 100644 index 8ee584f0c..000000000 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/configtx.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - ---- - -Organizations: -- &OrdererOrg - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/ordererOrganizations/example.com/msp - AdminPrincipal: Role.MEMBER - -- &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7051 - -- &Org2 - Name: Org2MSP - ID: Org2MSP - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org2.example.com - Port: 7051 - -Orderer: &OrdererDefaults - OrdererType: etcdraft - Addresses: - - orderer0.example.com:7050 - - orderer1.example.com:7050 - - BatchTimeout: 500ms - BatchSize: - MaxMessageCount: 50 - AbsoluteMaxBytes: 1 MB - PreferredMaxBytes: 1 MB - - MaxChannels: 0 - EtcdRaft: - Consenters: - - Host: orderer0.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - - Host: orderer1.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - - Organizations: - -Application: &ApplicationDefaults - Organizations: - -Profiles: - OrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - SampleConsortium2: - Organizations: - - *Org1 - - *Org2 - ChannelConfig: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/crypto-config.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/crypto-config.yaml deleted file mode 100644 index d66bf601d..000000000 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/crypto-config.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -OrdererOrgs: -- Name: Orderer - Domain: example.com - - Template: - Count: 2 - -PeerOrgs: -- Name: Org1 - Domain: org1.example.com - Template: - Count: 1 - Users: - Count: 1 - -- Name: Org2 - Domain: org2.example.com - Template: - Count: 1 - Users: - Count: 1 diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/generate.sh b/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/generate.sh deleted file mode 100755 index 061338094..000000000 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/config/generate.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# if the binaries are not available, download them -if [[ ! -d "bin" ]]; then - curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 1.4.8 1.4.8 0.4.15 -ds -fi - -rm -rf ./crypto-config/ -rm -f ./genesis.block -rm -f ./mychannel.tx - -./bin/cryptogen generate --config=./crypto-config.yaml -./bin/configtxgen -profile OrdererGenesis -outputBlock genesis.block -channelID syschannel -./bin/configtxgen -profile ChannelConfig -outputCreateChannelTx mychannel.tx -channelID mychannel - -# Rename the key files we use to be key.pem instead of a uuid -for KEY in $(find crypto-config -type f -name "*_sk"); do - KEY_DIR=$(dirname ${KEY}) - mv ${KEY} ${KEY_DIR}/key.pem -done diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/docker-compose.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/docker-compose.yaml index 87e126e91..9134c00a6 100644 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/docker-compose.yaml +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/docker-compose.yaml @@ -14,253 +14,8 @@ version: '3' -volumes: - prometheus_data: {} - services: -####### -# CAs # -####### - - ca.org1.example.com: - image: hyperledger/fabric-ca:1.4.8 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem -# ports: -# - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org1.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org1.example.com - - ca.org2.example.com: - image: hyperledger/fabric-ca:1.4.8 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org2.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem -# ports: -# - "8054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org2.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org2.example.com - -############ -# ORDERERS # -############ - - orderer0.example.com: - container_name: orderer0.example.com - image: hyperledger/fabric-orderer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Mutual TLS - - ORDERER_GENERAL_TLS_CLIENTAUTHREQUIRED=true - - ORDERER_GENERAL_TLS_CLIENTROOTCAS=[/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem, /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem, /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer -# ports: -# - 7050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - - orderer1.example.com: - container_name: orderer1.example.com - image: hyperledger/fabric-orderer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Mutual TLS - - ORDERER_GENERAL_TLS_CLIENTAUTHREQUIRED=true - - ORDERER_GENERAL_TLS_CLIENTROOTCAS=[/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem, /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem, /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer -# ports: -# - 8050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - -######### -# PEERS # -######### - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # Mutual TLS - - CORE_PEER_TLS_CLIENTAUTHREQUIRED=true - - CORE_PEER_TLS_CLIENTROOTCAS_FILES=/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start -# ports: -# - 7051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org1.example.com - - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: hyperledger/fabric-couchdb:0.4.14 -# ports: -# - 5984:5984 - environment: - DB_URL: http://localhost:5984/member_db - - peer0.org2.example.com: - container_name: peer0.org2.example.com - image: hyperledger/fabric-peer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org2.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org2.example.com:5984 - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # Mutual TLS - - CORE_PEER_TLS_CLIENTAUTHREQUIRED=true - - CORE_PEER_TLS_CLIENTROOTCAS_FILES=/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start -# ports: -# - 8051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org2.example.com - - couchdb.peer0.org2.example.com: - container_name: couchdb.peer0.org2.example.com - image: hyperledger/fabric-couchdb:0.4.14 -# ports: -# - 6984:5984 - environment: - DB_URL: http://localhost:5984/member_db - #################### # CALIPER SERVICES # #################### @@ -306,3 +61,8 @@ services: - "9001:9001" volumes: - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf + +networks: + default: + name: fabric_test + external: true diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/networkconfig.yaml b/packages/caliper-tests-integration/fabric_docker_distributed_tests/networkconfig.yaml index fc9252210..2790aad78 100644 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/networkconfig.yaml @@ -13,152 +13,42 @@ # name: Fabric -version: "1.0" -mutual-tls: true +version: "2.0.0" caliper: blockchain: fabric - -clients: - client0.org1.example.com: - client: - organization: Org1 - credentialStore: - path: /tmp/hfc-kvs/org1 - cryptoStore: - path: /tmp/hfc-cvs/org1 - clientPrivateKey: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem - clientSignedCert: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem - - client0.org2.example.com: - client: - organization: Org2 - credentialStore: - path: /tmp/hfc-kvs/org2 - cryptoStore: - path: /tmp/hfc-cvs/org2 - clientPrivateKey: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem - clientSignedCert: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem + sutOptions : + mutualTls: false channels: - mychannel: - created: false - configBinary: ./config/mychannel.tx - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - - contracts: - - id: marbles - contractID: mymarbles - version: v0 - language: node - path: src/marbles/node - metadataPath: src/marbles/node/metadata - yourchannel: - created: false - definition: - capabilities: [] - consortium: 'SampleConsortium2' - msps: ['Org1MSP', 'Org2MSP'] - version: 0 - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - - contracts: - - id: marbles - contractID: yourmarbles - version: v0 - language: golang - path: marbles/go - metadataPath: src/marbles/go/metadata + - channelName: mychannel + contracts: + - id: mymarbles + - channelName: yourchannel + contracts: + - id: yourmarbles organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com - adminPrivateKey: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/key.pem - signedCert: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem - - Org2: - mspid: Org2MSP - peers: - - peer0.org2.example.com - certificateAuthorities: - - ca.org2.example.com - adminPrivateKey: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/key.pem - signedCert: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem - -orderers: - orderer0.example.com: - url: grpcs://orderer0.example.com:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://orderer1.example.com:7050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://peer0.org1.example.com:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://peer0.org2.example.com:7051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -certificateAuthorities: - ca.org1.example.com: - url: https://ca.org1.example.com:7054 - httpOptions: - verify: false - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw - - ca.org2.example.com: - url: https://ca.org2.example.com:7054 - httpOptions: - verify: false - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw + - mspid: Org1MSP + identities: + certificates: + - name: 'client0.org1.example.com' + clientPrivateKey: + path: './fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_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' + connectionProfile: + path: './ccp-org1.yaml' + discover: false + + - mspid: Org2MSP + identities: + certificates: + - name: 'client0.org2.example.com' + clientPrivateKey: + path: './fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_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' + connectionProfile: + path: './ccp-org2.yaml' + discover: false diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-with-build.sh b/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-with-build.sh index 678866dcc..065dc2070 100755 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-with-build.sh +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-with-build.sh @@ -18,11 +18,21 @@ set -v # Grab the parent (fabric_tests) directory. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + cd "${DIR}" -# generate the crypto materials -cd ./config -./generate.sh +if [[ ! -d "fabric-samples" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +fi + +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 # back to this dir cd ${DIR} @@ -39,5 +49,4 @@ sleep 5s cd ${DIR} npm i -docker-compose -p caliper up -d - +docker-compose -p caliper up diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-without-build.sh b/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-without-build.sh index d422c72d9..e3b01abe1 100755 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-without-build.sh +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/run-without-build.sh @@ -18,14 +18,24 @@ set -v # Grab the parent (fabric_tests) directory. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + cd "${DIR}" -# generate the crypto materials -cd ./config -./generate.sh +if [[ ! -d "fabric-samples" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +fi + +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 # back to this dir cd ${DIR} npm i -docker-compose -p caliper up -d +docker-compose -p caliper up diff --git a/packages/caliper-tests-integration/fabric_docker_distributed_tests/src/marbles/node/package.json b/packages/caliper-tests-integration/fabric_docker_distributed_tests/src/marbles/node/package.json index 724fea100..c48659644 100644 --- a/packages/caliper-tests-integration/fabric_docker_distributed_tests/src/marbles/node/package.json +++ b/packages/caliper-tests-integration/fabric_docker_distributed_tests/src/marbles/node/package.json @@ -12,6 +12,6 @@ "engine-strict": true, "license": "Apache-2.0", "dependencies": { - "fabric-shim": "~1.4.0" + "fabric-shim": "2.4.2" } } diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/.gitignore b/packages/caliper-tests-integration/fabric_docker_local_tests/.gitignore index c9216fbdd..f44eb31f6 100644 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/.gitignore +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/.gitignore @@ -2,3 +2,4 @@ report.html node_modules/* package-lock.json +fabric-samples diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/caliper.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/caliper.yaml index f31c62e20..620a7a7f5 100644 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/caliper.yaml +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/caliper.yaml @@ -16,7 +16,7 @@ caliper: benchconfig: ./benchconfig.yaml networkconfig: ./networkconfig.yaml bind: - sut: fabric:1.4.1 + sut: fabric:2.4 report: path: ./report.html logging: diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org1.yaml similarity index 59% rename from packages/caliper-tests-integration/fabric_tests/phase4/ccp-org1.yaml rename to packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org1.yaml index 05bbc5e6b..fa5daf049 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/ccp-org1.yaml +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org1.yaml @@ -28,41 +28,34 @@ organizations: - peer0.org1.example.com orderers: - orderer0.example.com: - url: grpcs://localhost:7050 + orderer.example.com: + url: grpcs://orderer.example.com:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: - url: grpcs://localhost:7051 + url: grpcs://peer0.org1.example.com:7051 grpcOptions: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://peer0.org2.example.com:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org2.yaml similarity index 59% rename from packages/caliper-tests-integration/fabric_tests/phase4/ccp-org2.yaml rename to packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org2.yaml index f8019837e..fdb377fe3 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/ccp-org2.yaml +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/ccp-org2.yaml @@ -28,41 +28,34 @@ organizations: - peer0.org2.example.com orderers: - orderer0.example.com: - url: grpcs://localhost:7050 + orderer.example.com: + url: grpcs://orderer.example.com:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: - url: grpcs://localhost:7051 + url: grpcs://peer0.org1.example.com:7051 grpcOptions: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://peer0.org2.example.com:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/clean.sh b/packages/caliper-tests-integration/fabric_docker_local_tests/clean.sh index 0cf43d427..38f33ec9d 100755 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/clean.sh +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/clean.sh @@ -16,7 +16,14 @@ # Print all commands. set -v +# Grab the parent (fabric_tests) directory. +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + +cd ${DIR} + docker-compose -p caliper down -(test -z \"$(docker ps -aq)\") || docker rm $(docker ps -aq) -(test -z \"$(docker images dev* -q)\") || docker rmi $(docker images dev* -q) +pushd ${TEST_NETWORK_DIR} +./network.sh down +popd diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/config/.gitignore b/packages/caliper-tests-integration/fabric_docker_local_tests/config/.gitignore deleted file mode 100644 index 2bc6f264d..000000000 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/config/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bin/* -config/* -crypto-config/* -genesis.block -mychannel.tx diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/config/configtx.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/config/configtx.yaml deleted file mode 100644 index 8ee584f0c..000000000 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/config/configtx.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - ---- - -Organizations: -- &OrdererOrg - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/ordererOrganizations/example.com/msp - AdminPrincipal: Role.MEMBER - -- &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7051 - -- &Org2 - Name: Org2MSP - ID: Org2MSP - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org2.example.com - Port: 7051 - -Orderer: &OrdererDefaults - OrdererType: etcdraft - Addresses: - - orderer0.example.com:7050 - - orderer1.example.com:7050 - - BatchTimeout: 500ms - BatchSize: - MaxMessageCount: 50 - AbsoluteMaxBytes: 1 MB - PreferredMaxBytes: 1 MB - - MaxChannels: 0 - EtcdRaft: - Consenters: - - Host: orderer0.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - - Host: orderer1.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - - Organizations: - -Application: &ApplicationDefaults - Organizations: - -Profiles: - OrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - SampleConsortium2: - Organizations: - - *Org1 - - *Org2 - ChannelConfig: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/config/crypto-config.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/config/crypto-config.yaml deleted file mode 100644 index d66bf601d..000000000 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/config/crypto-config.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -OrdererOrgs: -- Name: Orderer - Domain: example.com - - Template: - Count: 2 - -PeerOrgs: -- Name: Org1 - Domain: org1.example.com - Template: - Count: 1 - Users: - Count: 1 - -- Name: Org2 - Domain: org2.example.com - Template: - Count: 1 - Users: - Count: 1 diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/config/generate.sh b/packages/caliper-tests-integration/fabric_docker_local_tests/config/generate.sh deleted file mode 100755 index 061338094..000000000 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/config/generate.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# if the binaries are not available, download them -if [[ ! -d "bin" ]]; then - curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 1.4.8 1.4.8 0.4.15 -ds -fi - -rm -rf ./crypto-config/ -rm -f ./genesis.block -rm -f ./mychannel.tx - -./bin/cryptogen generate --config=./crypto-config.yaml -./bin/configtxgen -profile OrdererGenesis -outputBlock genesis.block -channelID syschannel -./bin/configtxgen -profile ChannelConfig -outputCreateChannelTx mychannel.tx -channelID mychannel - -# Rename the key files we use to be key.pem instead of a uuid -for KEY in $(find crypto-config -type f -name "*_sk"); do - KEY_DIR=$(dirname ${KEY}) - mv ${KEY} ${KEY_DIR}/key.pem -done diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/docker-compose.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/docker-compose.yaml index 11a240a19..4c48abb7d 100644 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/docker-compose.yaml +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/docker-compose.yaml @@ -16,248 +16,6 @@ version: '3' services: -####### -# CAs # -####### - - ca.org1.example.com: - image: hyperledger/fabric-ca:1.4.8 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem -# ports: -# - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org1.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org1.example.com - - ca.org2.example.com: - image: hyperledger/fabric-ca:1.4.8 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org2.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem -# ports: -# - "8054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org2.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org2.example.com - -############ -# ORDERERS # -############ - - orderer0.example.com: - container_name: orderer0.example.com - image: hyperledger/fabric-orderer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Mutual TLS - - ORDERER_GENERAL_TLS_CLIENTAUTHREQUIRED=true - - ORDERER_GENERAL_TLS_CLIENTROOTCAS=[/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem, /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem, /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer -# ports: -# - 7050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - - orderer1.example.com: - container_name: orderer1.example.com - image: hyperledger/fabric-orderer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Mutual TLS - - ORDERER_GENERAL_TLS_CLIENTAUTHREQUIRED=true - - ORDERER_GENERAL_TLS_CLIENTROOTCAS=[/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem, /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem, /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer -# ports: -# - 8050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - -######### -# PEERS # -######### - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # Mutual TLS - - CORE_PEER_TLS_CLIENTAUTHREQUIRED=true - - CORE_PEER_TLS_CLIENTROOTCAS_FILES=/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start -# ports: -# - 7051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org1.example.com - - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: hyperledger/fabric-couchdb:0.4.14 -# ports: -# - 5984:5984 - environment: - DB_URL: http://localhost:5984/member_db - - peer0.org2.example.com: - container_name: peer0.org2.example.com - image: hyperledger/fabric-peer:1.4.8 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org2.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org2.example.com:5984 - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # Mutual TLS - - CORE_PEER_TLS_CLIENTAUTHREQUIRED=true - - CORE_PEER_TLS_CLIENTROOTCAS_FILES=/etc/hyperledger/msp/caOrg1/ca.org1.example.com-cert.pem /etc/hyperledger/msp/caOrg2/ca.org2.example.com-cert.pem /etc/hyperledger/msp/caOrderer/ca.example.com-cert.pem - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start -# ports: -# - 8051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org2.example.com - - couchdb.peer0.org2.example.com: - container_name: couchdb.peer0.org2.example.com - image: hyperledger/fabric-couchdb:0.4.14 -# ports: -# - 6984:5984 - environment: - DB_URL: http://localhost:5984/member_db - ################### # CALIPER MANAGER # ################### @@ -268,7 +26,8 @@ services: command: launch manager volumes: - ./:/hyperledger/caliper/workspace - depends_on: - - peer0.org1.example.com - - peer0.org2.example.com +networks: + default: + name: fabric_test + external: true diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/networkconfig.yaml b/packages/caliper-tests-integration/fabric_docker_local_tests/networkconfig.yaml index fc9252210..2790aad78 100644 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/networkconfig.yaml @@ -13,152 +13,42 @@ # name: Fabric -version: "1.0" -mutual-tls: true +version: "2.0.0" caliper: blockchain: fabric - -clients: - client0.org1.example.com: - client: - organization: Org1 - credentialStore: - path: /tmp/hfc-kvs/org1 - cryptoStore: - path: /tmp/hfc-cvs/org1 - clientPrivateKey: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem - clientSignedCert: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem - - client0.org2.example.com: - client: - organization: Org2 - credentialStore: - path: /tmp/hfc-kvs/org2 - cryptoStore: - path: /tmp/hfc-cvs/org2 - clientPrivateKey: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem - clientSignedCert: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem + sutOptions : + mutualTls: false channels: - mychannel: - created: false - configBinary: ./config/mychannel.tx - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - - contracts: - - id: marbles - contractID: mymarbles - version: v0 - language: node - path: src/marbles/node - metadataPath: src/marbles/node/metadata - yourchannel: - created: false - definition: - capabilities: [] - consortium: 'SampleConsortium2' - msps: ['Org1MSP', 'Org2MSP'] - version: 0 - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - - contracts: - - id: marbles - contractID: yourmarbles - version: v0 - language: golang - path: marbles/go - metadataPath: src/marbles/go/metadata + - channelName: mychannel + contracts: + - id: mymarbles + - channelName: yourchannel + contracts: + - id: yourmarbles organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com - adminPrivateKey: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/key.pem - signedCert: - path: ./config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem - - Org2: - mspid: Org2MSP - peers: - - peer0.org2.example.com - certificateAuthorities: - - ca.org2.example.com - adminPrivateKey: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/key.pem - signedCert: - path: ./config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem - -orderers: - orderer0.example.com: - url: grpcs://orderer0.example.com:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://orderer1.example.com:7050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://peer0.org1.example.com:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://peer0.org2.example.com:7051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -certificateAuthorities: - ca.org1.example.com: - url: https://ca.org1.example.com:7054 - httpOptions: - verify: false - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw - - ca.org2.example.com: - url: https://ca.org2.example.com:7054 - httpOptions: - verify: false - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw + - mspid: Org1MSP + identities: + certificates: + - name: 'client0.org1.example.com' + clientPrivateKey: + path: './fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_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' + connectionProfile: + path: './ccp-org1.yaml' + discover: false + + - mspid: Org2MSP + identities: + certificates: + - name: 'client0.org2.example.com' + clientPrivateKey: + path: './fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_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' + connectionProfile: + path: './ccp-org2.yaml' + discover: false diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/run-with-build.sh b/packages/caliper-tests-integration/fabric_docker_local_tests/run-with-build.sh index 678866dcc..065dc2070 100755 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/run-with-build.sh +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/run-with-build.sh @@ -18,11 +18,21 @@ set -v # Grab the parent (fabric_tests) directory. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + cd "${DIR}" -# generate the crypto materials -cd ./config -./generate.sh +if [[ ! -d "fabric-samples" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +fi + +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 # back to this dir cd ${DIR} @@ -39,5 +49,4 @@ sleep 5s cd ${DIR} npm i -docker-compose -p caliper up -d - +docker-compose -p caliper up diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/run-without-build.sh b/packages/caliper-tests-integration/fabric_docker_local_tests/run-without-build.sh index ce3d289a5..e3b01abe1 100755 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/run-without-build.sh +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/run-without-build.sh @@ -18,15 +18,24 @@ set -v # Grab the parent (fabric_tests) directory. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_NETWORK_DIR=${DIR}/fabric-samples/test-network + cd "${DIR}" -# generate the crypto materials -cd ./config -./generate.sh +if [[ ! -d "fabric-samples" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +fi + +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 # back to this dir cd ${DIR} npm i -docker-compose -p caliper up -d - +docker-compose -p caliper up diff --git a/packages/caliper-tests-integration/fabric_docker_local_tests/src/marbles/node/package.json b/packages/caliper-tests-integration/fabric_docker_local_tests/src/marbles/node/package.json index d20317283..c48659644 100644 --- a/packages/caliper-tests-integration/fabric_docker_local_tests/src/marbles/node/package.json +++ b/packages/caliper-tests-integration/fabric_docker_local_tests/src/marbles/node/package.json @@ -12,6 +12,6 @@ "engine-strict": true, "license": "Apache-2.0", "dependencies": { - "fabric-shim": "1.4.5" + "fabric-shim": "2.4.2" } } diff --git a/packages/caliper-tests-integration/fabric_tests/.gitignore b/packages/caliper-tests-integration/fabric_tests/.gitignore index af0b11a23..73806d919 100644 --- a/packages/caliper-tests-integration/fabric_tests/.gitignore +++ b/packages/caliper-tests-integration/fabric_tests/.gitignore @@ -1,2 +1,3 @@ **/*.log report.html +fabric-samples diff --git a/packages/caliper-tests-integration/fabric_tests/config/.gitignore b/packages/caliper-tests-integration/fabric_tests/config/.gitignore deleted file mode 100644 index 2bc6f264d..000000000 --- a/packages/caliper-tests-integration/fabric_tests/config/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bin/* -config/* -crypto-config/* -genesis.block -mychannel.tx diff --git a/packages/caliper-tests-integration/fabric_tests/config/configtx.yaml b/packages/caliper-tests-integration/fabric_tests/config/configtx.yaml deleted file mode 100644 index 8ee584f0c..000000000 --- a/packages/caliper-tests-integration/fabric_tests/config/configtx.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - ---- - -Organizations: -- &OrdererOrg - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/ordererOrganizations/example.com/msp - AdminPrincipal: Role.MEMBER - -- &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7051 - -- &Org2 - Name: Org2MSP - ID: Org2MSP - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - AdminPrincipal: Role.ADMIN - AnchorPeers: - - Host: peer0.org2.example.com - Port: 7051 - -Orderer: &OrdererDefaults - OrdererType: etcdraft - Addresses: - - orderer0.example.com:7050 - - orderer1.example.com:7050 - - BatchTimeout: 500ms - BatchSize: - MaxMessageCount: 50 - AbsoluteMaxBytes: 1 MB - PreferredMaxBytes: 1 MB - - MaxChannels: 0 - EtcdRaft: - Consenters: - - Host: orderer0.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt - - Host: orderer1.example.com - Port: 7050 - ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - - Organizations: - -Application: &ApplicationDefaults - Organizations: - -Profiles: - OrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - SampleConsortium2: - Organizations: - - *Org1 - - *Org2 - ChannelConfig: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 diff --git a/packages/caliper-tests-integration/fabric_tests/config/crypto-config.yaml b/packages/caliper-tests-integration/fabric_tests/config/crypto-config.yaml deleted file mode 100644 index d66bf601d..000000000 --- a/packages/caliper-tests-integration/fabric_tests/config/crypto-config.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -OrdererOrgs: -- Name: Orderer - Domain: example.com - - Template: - Count: 2 - -PeerOrgs: -- Name: Org1 - Domain: org1.example.com - Template: - Count: 1 - Users: - Count: 1 - -- Name: Org2 - Domain: org2.example.com - Template: - Count: 1 - Users: - Count: 1 diff --git a/packages/caliper-tests-integration/fabric_tests/config/generate.sh b/packages/caliper-tests-integration/fabric_tests/config/generate.sh deleted file mode 100755 index 061338094..000000000 --- a/packages/caliper-tests-integration/fabric_tests/config/generate.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# if the binaries are not available, download them -if [[ ! -d "bin" ]]; then - curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 1.4.8 1.4.8 0.4.15 -ds -fi - -rm -rf ./crypto-config/ -rm -f ./genesis.block -rm -f ./mychannel.tx - -./bin/cryptogen generate --config=./crypto-config.yaml -./bin/configtxgen -profile OrdererGenesis -outputBlock genesis.block -channelID syschannel -./bin/configtxgen -profile ChannelConfig -outputCreateChannelTx mychannel.tx -channelID mychannel - -# Rename the key files we use to be key.pem instead of a uuid -for KEY in $(find crypto-config -type f -name "*_sk"); do - KEY_DIR=$(dirname ${KEY}) - mv ${KEY} ${KEY_DIR}/key.pem -done diff --git a/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml b/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml index 974509489..34b337f20 100644 --- a/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml +++ b/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml @@ -19,253 +19,6 @@ volumes: services: -####### -# CAs # -####### - - ca.org1.example.com: - image: hyperledger/fabric-ca:1.5.3 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem - ports: - - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org1.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org1.example.com - - - ca.org2.example.com: - image: hyperledger/fabric-ca:1.5.3 - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org2.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/key.pem - # TLS - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/key.pem - ports: - - "8054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - - ./config/crypto-config/peerOrganizations/org2.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls - container_name: ca.org2.example.com - -############ -# ORDERERS # -############ - - orderer0.example.com: - container_name: orderer0.example.com - image: hyperledger/fabric-orderer:2.4.3 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer - ports: - - 7050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - - orderer1.example.com: - container_name: orderer1.example.com - image: hyperledger/fabric-orderer:2.4.3 - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - # TLS - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt] - # Raft TLS - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key - # setting up metrics - - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - ORDERER_OPERATIONS_TLS_ENABLED=false - - ORDERER_METRICS_ENABLE=true - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: orderer - ports: - - 8050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/:/etc/hyperledger/msp/orderer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - ca.org1.example.com - - ca.org2.example.com - -######### -# PEERS # -######### - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:2.4.3 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD - # provide the credentials for ledger to connect to CouchDB. The username and password must - # match the username and password set for the associated CouchDB. - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start - ports: - - 7051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org1.example.com - - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:3.1.1 - ports: - - 5984:5984 - # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password - # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. - environment: - - COUCHDB_USER=admin - - COUCHDB_PASSWORD=adminpw - - peer0.org2.example.com: - container_name: peer0.org2.example.com - image: hyperledger/fabric-peer:2.4.3 - environment: - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=INFO - - CORE_CHAINCODE_LOGGING_SHIM=INFO - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org2.example.com - - CORE_PEER_ENDORSER_ENABLED=true - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/msp/ - - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=caliper_default - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org2.example.com:5984 - # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD - # provide the credentials for ledger to connect to CouchDB. The username and password must - # match the username and password set for the associated CouchDB. - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw - # TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/msp/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/msp/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/msp/peer/tls/ca.crt - # setting up metrics - - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9000 - - CORE_OPERATIONS_TLS_ENABLED=false - - CORE_METRICS_ENABLE=true - - CORE_METRICS_PROVIDER=prometheus - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start - ports: - - 8051:7051 - volumes: - - /var/run/:/host/var/run/ - - ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer - - ./config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/msp/caOrg1 - - ./config/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/msp/caOrg2 - - ./config/crypto-config/ordererOrganizations/example.com/ca/:/etc/hyperledger/msp/caOrderer - depends_on: - - orderer0.example.com - - orderer1.example.com - - couchdb.peer0.org2.example.com - - couchdb.peer0.org2.example.com: - container_name: couchdb.peer0.org2.example.com - image: couchdb:3.1.1 - ports: - - 6984:5984 - # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password - # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. - environment: - - COUCHDB_USER=admin - - COUCHDB_PASSWORD=adminpw - ############## # MONITORING # ############## @@ -283,9 +36,6 @@ services: - '--web.console.templates=/usr/share/prometheus/consoles' ports: - "9090:9090" - depends_on: - - peer0.org2.example.com - - peer0.org1.example.com pushGateway: image: prom/pushgateway @@ -317,4 +67,9 @@ services: - "1883:1883" - "9001:9001" volumes: - - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf \ No newline at end of file + - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf + +networks: + default: + name: fabric_test + external: true diff --git a/packages/caliper-tests-integration/fabric_tests/initByChannel.js b/packages/caliper-tests-integration/fabric_tests/initByChannel.js index ce42e879b..26ba1b5df 100644 --- a/packages/caliper-tests-integration/fabric_tests/initByChannel.js +++ b/packages/caliper-tests-integration/fabric_tests/initByChannel.js @@ -61,7 +61,7 @@ class MarblesInitByChannelWorkload extends WorkloadModuleBase { let marbleOwner = this.owners[this.txIndex % this.owners.length]; let args = { - contractId: 'marbles', + contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractVersion: 'v0', contractFunction: 'initMarble', invokerIdentity: 'client0.org1.example.com', diff --git a/packages/caliper-tests-integration/fabric_tests/phase1/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase1/networkconfig.yaml index c71827c93..f6df96b10 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase1/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase1/networkconfig.yaml @@ -18,4 +18,4 @@ version: "2.0.0" caliper: blockchain: fabric command: - start: docker-compose -p caliper up -d;rm -rf /tmp/hfc-*;sleep 5s + start: docker-compose -p caliper up -d; sleep 5s diff --git a/packages/caliper-tests-integration/fabric_tests/phase2/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase2/benchconfig.yaml index 4b314a8bd..918a41762 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/benchconfig.yaml @@ -18,23 +18,60 @@ test: number: 2 rounds: - label: init1 - txNumber: 100 - rateControl: { type: 'fixed-rate', opts: { tps: 20 } } + txNumber: 50 + rateControl: { type: 'fixed-rate', opts: { tps: 5 } } workload: - module: ./../init.js + module: ./../init.js + arguments: + marblePrefix: marbles_phase_2 + - label: query1 + txNumber: 50 + rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } + workload: + module: ./../query.js - label: init2 - txNumber: 200 - rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } + txNumber: 50 + rateControl: { type: 'fixed-rate', opts: { tps: 5 } } workload: - module: ./../init.js - - label: query - txNumber: 100 - rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } + module: ./../initByChannel.js + arguments: + marblePrefix: marbles_phase_2 + - label: query2 + txNumber: 50 + rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } workload: - module: ./../query.js + module: ./../queryByChannel.js + monitors: + transaction: + - module: logging + options: + loggerModuleName: txinfo + messageLevel: info + - module: prometheus-push + options: + pushInterval: 5000 + pushUrl: "http://localhost:9091" resource: - - module: process + - module: prometheus options: - interval: 3 - processes: [{ command: 'node', arguments: 'caliper.js', multiOutput: 'avg' }] + url: "http://localhost:9090" + metrics: + include: [peer*, dev*] + queries: + - name: Endorse Time (s) + query: rate(endorser_propsal_duration_sum{chaincode="marbles:v0"}[1m])/rate(endorser_propsal_duration_count{chaincode="marbles:v0"}[1m]) + step: 1 + label: instance + statistic: avg + - name: Max Memory (MB) + query: sum(container_memory_rss{name=~".+"}) by (name) + step: 10 + label: name + statistic: max + multiplier: 0.000001 + charting: + polar: + metrics: [Max Memory (MB)] + bar: + metrics: [all] 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 05bbc5e6b..95af81d2e 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org1.yaml @@ -28,18 +28,12 @@ organizations: - peer0.org1.example.com orderers: - orderer0.example.com: + orderer.example.com: url: grpcs://localhost:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: @@ -48,21 +42,20 @@ peers: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://localhost:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: 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 f8019837e..f15774bee 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/ccp-org2.yaml @@ -28,18 +28,12 @@ organizations: - peer0.org2.example.com orderers: - orderer0.example.com: + orderer.example.com: url: grpcs://localhost:7050 grpcOptions: - ssl-target-name-override: orderer0.example.com + ssl-target-name-override: orderer.example.com tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + path: ./fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem peers: peer0.org1.example.com: @@ -48,21 +42,20 @@ peers: ssl-target-name-override: peer0.org1.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + 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:8051 + url: grpcs://localhost:9051 grpcOptions: ssl-target-name-override: peer0.org2.example.com grpc.keepalive_time_ms: 600000 tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + 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: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: eventSource: true @@ -70,8 +63,7 @@ channels: eventSource: true yourchannel: orderers: - - orderer0.example.com - - orderer1.example.com + - orderer.example.com peers: peer0.org1.example.com: 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 454b66115..5d0170a56 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml @@ -22,33 +22,21 @@ caliper: channels: - channelName: mychannel - create: - prebuiltTransaction: ../config/mychannel.tx contracts: - - id: marbles - contractID: mymarbles - + - id: mymarbles - channelName: yourchannel - create: - buildTransaction: - capabilities: [] - consortium: 'SampleConsortium2' - msps: ['Org1MSP', 'Org2MSP'] - version: 0 contracts: - - id: marbles - contractID: yourmarbles + - id: yourmarbles organizations: - mspid: Org1MSP identities: certificates: - - name: 'admin.org1.example.com' - admin: true + - name: 'client0.org1.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' connectionProfile: path: './ccp-org1.yaml' discover: false @@ -56,13 +44,11 @@ organizations: - mspid: Org2MSP identities: certificates: - - name: 'admin.org2.example.com' - admin: true + - name: 'client0.org2.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.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 dd6090ac7..2caf26800 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase3/benchconfig.yaml @@ -17,23 +17,56 @@ test: workers: number: 2 rounds: - - label: init1 - txNumber: 100 - rateControl: { type: 'fixed-rate', opts: { tps: 20 } } - workload: - module: ./../init.js - - label: init2 - txNumber: 200 - rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } - workload: - module: ./../init.js - - label: query - txNumber: 100 - rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } + - label: query1 + txNumber: 50 + rateControl: + type: composite-rate + opts: + weights: [2,1] + rateControllers: + - type: fixed-rate + opts: + tps: 2 + - type: fixed-rate + opts: + tps: 4 workload: module: ./../query.js + - label: query2 + txDuration: 20 + rateControl: { type: 'fixed-load', opts: { startTps: 10, transactionLoad: 20 } } + workload: + module: ./../queryByChannel.js + monitors: + transaction: + - module: prometheus-push + options: + pushInterval: 5000 + pushUrl: "http://localhost:9091" resource: + - module: prometheus + options: + url: "http://localhost:9090" + metrics: + include: [peer*, dev*] + queries: + - name: Endorse Time (s) + query: rate(endorser_propsal_duration_sum{chaincode="marbles:v0"}[1m])/rate(endorser_propsal_duration_count{chaincode="marbles:v0"}[1m]) + step: 1 + label: instance + statistic: avg + - name: Max Memory (MB) + query: sum(container_memory_rss{name=~".+"}) by (name) + step: 10 + label: name + statistic: max + multiplier: 0.000001 + charting: + polar: + metrics: [Max Memory (MB)] + bar: + metrics: [all] - module: process options: interval: 3 diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_tests/phase3/ccp-org1.yaml deleted file mode 100644 index 05bbc5e6b..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase3/ccp-org1.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: test-network-org1 -version: 1.0.0 -client: - organization: Org1 - connection: - timeout: - peer: - endorser: '300' - -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - -orderers: - orderer0.example.com: - url: grpcs://localhost:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -channels: - mychannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - yourchannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml index b3e7d48cc..91368cf86 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml @@ -23,48 +23,32 @@ caliper: channels: - channelName: mychannel contracts: - - id: marbles - contractID: mymarbles - install: - version: v0 - language: node - path: src/marbles/node - metadataPath: src/marbles/node/metadata - + - id: mymarbles - channelName: yourchannel contracts: - - id: marbles - contractID: yourmarbles - install: - version: v0 - language: golang - path: marbles/go - metadataPath: src/marbles/go/metadata + - id: yourmarbles organizations: - mspid: Org1MSP identities: certificates: - - name: 'admin.org1.example.com' - admin: true + - name: 'client0.org1.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' connectionProfile: - path: './ccp-org1.yaml' - discover: false + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml' + discover: true - mspid: Org2MSP identities: certificates: - - name: 'admin.org2.example.com' - admin: true + - name: 'client0.org2.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' connectionProfile: - path: './ccp-org2.yaml' - discover: false - + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml' + discover: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase4/benchconfig.yaml index 36b91782c..f1f98eab7 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase4/benchconfig.yaml @@ -18,36 +18,31 @@ test: number: 2 rounds: - label: init1 - txNumber: 50 + txNumber: 25 rateControl: { type: 'fixed-rate', opts: { tps: 5 } } workload: module: ./../init.js arguments: marblePrefix: marbles_phase_4 - label: query1 - txNumber: 50 + txNumber: 25 rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } workload: module: ./../query.js - label: init2 - txNumber: 50 + txNumber: 25 rateControl: { type: 'fixed-rate', opts: { tps: 5 } } workload: module: ./../initByChannel.js arguments: marblePrefix: marbles_phase_4 - label: query2 - txNumber: 50 + txNumber: 25 rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } workload: module: ./../queryByChannel.js - monitors: transaction: - - module: logging - options: - loggerModuleName: txinfo - messageLevel: info - module: prometheus-push options: pushInterval: 5000 diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml index d629bcd62..91368cf86 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml @@ -23,12 +23,10 @@ caliper: channels: - channelName: mychannel contracts: - - id: marbles - contractID: mymarbles + - id: mymarbles - channelName: yourchannel contracts: - - id: marbles - contractID: yourmarbles + - id: yourmarbles organizations: - mspid: Org1MSP @@ -36,22 +34,21 @@ organizations: certificates: - name: 'client0.org1.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' connectionProfile: - path: './ccp-org1.yaml' - discover: false + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml' + discover: true - mspid: Org2MSP identities: certificates: - name: 'client0.org2.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' connectionProfile: - path: './ccp-org2.yaml' - discover: false - + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml' + 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 2caf26800..17362faa3 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase5/benchconfig.yaml @@ -17,27 +17,30 @@ test: workers: number: 2 rounds: + - label: init1 + txNumber: 100 + rateControl: { type: 'fixed-load', opts: { "transactionLoad": 5, "startingTps": 100 }} + workload: + module: ./../init.js + arguments: + marblePrefix: marbles_phase_5 - label: query1 - txNumber: 50 - rateControl: - type: composite-rate - opts: - weights: [2,1] - rateControllers: - - type: fixed-rate - opts: - tps: 2 - - type: fixed-rate - opts: - tps: 4 + txNumber: 200 + rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } + workload: + module: ./queryByChannelNoTargetPeers.js + - label: init2 + txNumber: 25 + rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } workload: - module: ./../query.js + module: ./../initByChannel.js + arguments: + marblePrefix: marbles_phase_5 - label: query2 - txDuration: 20 - rateControl: { type: 'fixed-load', opts: { startTps: 10, transactionLoad: 20 } } + txNumber: 25 + rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } workload: - module: ./../queryByChannel.js - + module: ./queryNoTargetPeers.js monitors: transaction: - module: prometheus-push @@ -75,3 +78,4 @@ monitors: options: interval: 4 containers: ['peer0.org1.example.com', 'peer0.org2.example.com', 'orderer0.example.com', 'orderer1.example.com'] + diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_tests/phase5/ccp-org2.yaml deleted file mode 100644 index e3df05836..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase5/ccp-org2.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: test-network-org2 -version: 1.0.0 -client: - organization: Org2 - connection: - timeout: - peer: - endorser: '300' - -organizations: - Org1: - mspid: Org2MSP - peers: - - peer0.org2.example.com - -orderers: - orderer0.example.com: - url: grpcs://localhost:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -channels: - mychannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - yourchannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml index d629bcd62..deb7fec91 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml @@ -23,12 +23,10 @@ caliper: channels: - channelName: mychannel contracts: - - id: marbles - contractID: mymarbles + - id: mymarbles - channelName: yourchannel contracts: - - id: marbles - contractID: yourmarbles + - id: yourmarbles organizations: - mspid: Org1MSP @@ -36,22 +34,29 @@ organizations: certificates: - name: 'client0.org1.example.com' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem - connectionProfile: - path: './ccp-org1.yaml' - discover: false + path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem' + peers: + - endpoint: localhost:7051 + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + 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' clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk' clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem - connectionProfile: - path: './ccp-org2.yaml' - discover: false - + path: '../fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem' + peers: + - endpoint: localhost:9051 + grpcOptions: + ssl-target-name-override: peer0.org2.example.com + 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/phase7/queryByChannelNoTargetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js similarity index 95% rename from packages/caliper-tests-integration/fabric_tests/phase7/queryByChannelNoTargetPeers.js rename to packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js index 6593f5402..0124fc789 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase7/queryByChannelNoTargetPeers.js +++ b/packages/caliper-tests-integration/fabric_tests/phase5/queryByChannelNoTargetPeers.js @@ -38,7 +38,7 @@ class MarblesQueryByChannelWorkload extends WorkloadModuleBase { let marbleOwner = this.owners[this.txIndex % this.owners.length]; let args = { - contractId: 'marbles', + contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractVersion: 'v0', channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', contractFunction: 'queryMarblesByOwner', diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/queryNoTargetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase7/queryNoTargetPeers.js rename to packages/caliper-tests-integration/fabric_tests/phase5/queryNoTargetPeers.js diff --git a/packages/caliper-tests-integration/fabric_tests/phase6/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase6/benchconfig.yaml index 900d0e138..0c64c33ae 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase6/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase6/benchconfig.yaml @@ -18,55 +18,21 @@ test: number: 2 rounds: - label: init1 - txNumber: 25 - rateControl: { type: 'fixed-rate', opts: { tps: 5 } } + txNumber: 100 + rateControl: { type: 'fixed-rate', opts: { tps: 20 } } workload: module: ./../init.js arguments: marblePrefix: marbles_phase_6 - - label: query1 - txNumber: 25 - rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } - workload: - module: ./../query.js - label: init2 - txNumber: 25 - rateControl: { type: 'fixed-rate', opts: { tps: 5 } } + txNumber: 200 + rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } workload: - module: ./../initByChannel.js + module: ./../init.js arguments: marblePrefix: marbles_phase_6 - - label: query2 - txNumber: 25 - rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } + - label: query + txNumber: 100 + rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } workload: - module: ./../queryByChannel.js -monitors: - transaction: - - module: prometheus-push - options: - pushInterval: 5000 - pushUrl: "http://localhost:9091" - resource: - - module: prometheus - options: - url: "http://localhost:9090" - metrics: - include: [peer*, dev*] - queries: - - name: Endorse Time (s) - query: rate(endorser_propsal_duration_sum{chaincode="marbles:v0"}[1m])/rate(endorser_propsal_duration_count{chaincode="marbles:v0"}[1m]) - step: 1 - label: instance - statistic: avg - - name: Max Memory (MB) - query: sum(container_memory_rss{name=~".+"}) by (name) - step: 10 - label: name - statistic: max - multiplier: 0.000001 - charting: - polar: - metrics: [Max Memory (MB)] - bar: - metrics: [all] + module: ./../query.js diff --git a/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org1.yaml deleted file mode 100644 index 05bbc5e6b..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org1.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: test-network-org1 -version: 1.0.0 -client: - organization: Org1 - connection: - timeout: - peer: - endorser: '300' - -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - -orderers: - orderer0.example.com: - url: grpcs://localhost:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -channels: - mychannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - yourchannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org2.yaml deleted file mode 100644 index f8019837e..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase6/ccp-org2.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: test-network-org2 -version: 1.0.0 -client: - organization: Org2 - connection: - timeout: - peer: - endorser: '300' - -organizations: - Org2: - mspid: Org2MSP - peers: - - peer0.org2.example.com - -orderers: - orderer0.example.com: - url: grpcs://localhost:7050 - grpcOptions: - ssl-target-name-override: orderer0.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - orderer1.example.com: - url: grpcs://localhost:8050 - grpcOptions: - ssl-target-name-override: orderer1.example.com - tlsCACerts: - path: ./config/crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - -peers: - peer0.org1.example.com: - url: grpcs://localhost:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem - - peer0.org2.example.com: - url: grpcs://localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ./config/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem - -channels: - mychannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true - yourchannel: - orderers: - - orderer0.example.com - - orderer1.example.com - peers: - peer0.org1.example.com: - eventSource: true - peer0.org2.example.com: - eventSource: true diff --git a/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml index d629bcd62..84b2afb8e 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml @@ -17,41 +17,5 @@ version: "2.0.0" caliper: blockchain: fabric - sutOptions : - mutualTls: false - -channels: - - channelName: mychannel - contracts: - - id: marbles - contractID: mymarbles - - channelName: yourchannel - contracts: - - id: marbles - contractID: yourmarbles - -organizations: - - mspid: Org1MSP - identities: - certificates: - - name: 'client0.org1.example.com' - clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem - clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem - connectionProfile: - path: './ccp-org1.yaml' - discover: false - - - mspid: Org2MSP - identities: - certificates: - - name: 'client0.org2.example.com' - clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem - clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem - connectionProfile: - path: './ccp-org2.yaml' - discover: false - + command: + end: docker-compose -p caliper down diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml deleted file mode 100644 index 8a175d74d..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - ---- -test: - workers: - number: 2 - rounds: - - label: init1 - txNumber: 100 - rateControl: { type: 'fixed-load', opts: { "transactionLoad": 5, "startingTps": 100 }} - workload: - module: ./../init.js - arguments: - marblePrefix: marbles_phase_7 - - label: query1 - txNumber: 200 - rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } - workload: - module: ./queryByChannelNoTargetPeers.js - - label: init2 - txNumber: 25 - rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } - workload: - module: ./../initByChannel.js - arguments: - marblePrefix: marbles_phase_7 - - label: query2 - txNumber: 25 - rateControl: { type: 'linear-rate', opts: { startingTps: 5, finishingTps: 10 } } - workload: - module: ./queryNoTargetPeers.js -monitors: - transaction: - - module: prometheus-push - options: - pushInterval: 5000 - pushUrl: "http://localhost:9091" - resource: - - module: prometheus - options: - url: "http://localhost:9090" - metrics: - include: [peer*, dev*] - queries: - - name: Endorse Time (s) - query: rate(endorser_propsal_duration_sum{chaincode="marbles:v0"}[1m])/rate(endorser_propsal_duration_count{chaincode="marbles:v0"}[1m]) - step: 1 - label: instance - statistic: avg - - name: Max Memory (MB) - query: sum(container_memory_rss{name=~".+"}) by (name) - step: 10 - label: name - statistic: max - multiplier: 0.000001 - charting: - polar: - metrics: [Max Memory (MB)] - bar: - metrics: [all] - - module: process - options: - interval: 3 - processes: [{ command: 'node', arguments: 'caliper.js', multiOutput: 'avg' }] - - module: docker - options: - interval: 4 - containers: ['peer0.org1.example.com', 'peer0.org2.example.com', 'orderer0.example.com', 'orderer1.example.com'] - diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml deleted file mode 100644 index 173f03a95..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml +++ /dev/null @@ -1,66 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: Fabric -version: "2.0.0" - -caliper: - blockchain: fabric - sutOptions : - mutualTls: false - -channels: - - channelName: mychannel - contracts: - - id: marbles - contractID: mymarbles - - channelName: yourchannel - contracts: - - id: marbles - contractID: yourmarbles - -organizations: - - mspid: Org1MSP - identities: - certificates: - - name: 'client0.org1.example.com' - clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/key.pem - clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem - peers: - - endpoint: localhost:7051 - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ../config/crypto-config/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' - clientPrivateKey: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/key.pem - clientSignedCert: - path: ../config/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem - peers: - - endpoint: localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - grpc.keepalive_time_ms: 600000 - tlsCACerts: - path: ../config/crypto-config/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/phase8/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml deleted file mode 100644 index 86aa85c53..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - ---- -test: - workers: - number: 2 - rounds: - - label: init1 - txNumber: 100 - rateControl: { type: 'fixed-rate', opts: { tps: 20 } } - workload: - module: ./../init.js - arguments: - marblePrefix: marbles_phase_5 - - label: init2 - txNumber: 200 - rateControl: { type: 'fixed-feedback-rate', opts: { tps: 20, maximum_transaction_load: 5 } } - workload: - module: ./../init.js - arguments: - marblePrefix: marbles_phase_5 - - label: query - txNumber: 100 - rateControl: { type: 'linear-rate', opts: { startingTps: 10, finishingTps: 20 } } - workload: - module: ./../query.js diff --git a/packages/caliper-tests-integration/fabric_tests/phase8/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase8/networkconfig.yaml deleted file mode 100644 index cc7ab138e..000000000 --- a/packages/caliper-tests-integration/fabric_tests/phase8/networkconfig.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: Fabric -version: "2.0.0" - -caliper: - blockchain: fabric - command: - end: docker-compose -p caliper down;(test -z \"$(docker ps -aq)\") || docker rm $(docker ps -aq);(test -z \"$(docker images dev* -q)\") || docker rmi $(docker images dev* -q);rm -rf /tmp/hfc-* diff --git a/packages/caliper-tests-integration/fabric_tests/queryByChannel.js b/packages/caliper-tests-integration/fabric_tests/queryByChannel.js index dfccbd9a0..74a59aec1 100644 --- a/packages/caliper-tests-integration/fabric_tests/queryByChannel.js +++ b/packages/caliper-tests-integration/fabric_tests/queryByChannel.js @@ -38,7 +38,7 @@ class MarblesQueryByChannelWorkload extends WorkloadModuleBase { let marbleOwner = this.owners[this.txIndex % this.owners.length]; let args = { - contractId: 'marbles', + contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', contractVersion: 'v0', channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', contractFunction: 'queryMarblesByOwner', diff --git a/packages/caliper-tests-integration/fabric_tests/run.sh b/packages/caliper-tests-integration/fabric_tests/run.sh index 076ecb472..d3da2d35e 100755 --- a/packages/caliper-tests-integration/fabric_tests/run.sh +++ b/packages/caliper-tests-integration/fabric_tests/run.sh @@ -20,9 +20,9 @@ set -v DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "${DIR}" -# generate the crypto materials -cd ./config -./generate.sh +if [[ ! -d "fabric-samples" ]]; then + curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- 2.4.3 +fi # back to this dir cd ${DIR} @@ -43,6 +43,17 @@ dispose () { ${CALL_METHOD} launch manager --caliper-workspace phase8 --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=$? @@ -52,9 +63,8 @@ if [[ ${rc} != 0 ]]; then exit ${rc}; fi -# PHASE 2: just initialize the network -# TODO: contracts shouldn't be required at this point -${CALL_METHOD} launch manager --caliper-workspace phase2 --caliper-flow-only-init +# PHASE 2: testing through the low-level API +${CALL_METHOD} launch manager --caliper-workspace phase2 --caliper-flow-only-test rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 2"; @@ -62,8 +72,8 @@ if [[ ${rc} != 0 ]]; then exit ${rc}; fi -# PHASE 3: just init network and install the contracts (channels marked as created) -${CALL_METHOD} launch manager --caliper-workspace phase3 --caliper-flow-skip-start --caliper-flow-skip-end --caliper-flow-skip-test +# PHASE 3: testing through the gateway API (v1 SDK) +${CALL_METHOD} launch manager --caliper-workspace phase3 --caliper-flow-only-test --caliper-fabric-gateway-enabled rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 3"; @@ -71,33 +81,6 @@ if [[ ${rc} != 0 ]]; then exit ${rc}; fi -# PHASE 3 again: deployed contracts should be detected -${CALL_METHOD} launch manager --caliper-workspace phase3 --caliper-flow-skip-start --caliper-flow-skip-end --caliper-flow-skip-test -rc=$? -if [[ ${rc} != 0 ]]; then - echo "Failed CI step 4"; - dispose; - exit ${rc}; -fi - -# PHASE 4: testing through the low-level API -${CALL_METHOD} launch manager --caliper-workspace phase4 --caliper-flow-only-test -rc=$? -if [[ ${rc} != 0 ]]; then - echo "Failed CI step 5"; - dispose; - exit ${rc}; -fi - -# PHASE 5: testing through the gateway API (v1 SDK) -${CALL_METHOD} launch manager --caliper-workspace phase5 --caliper-flow-only-test --caliper-fabric-gateway-enabled -rc=$? -if [[ ${rc} != 0 ]]; then - echo "Failed CI step 6"; - dispose; - exit ${rc}; -fi - # UNBIND SDK, using the package dir as CWD # Note: do not use env variables for unbinding settings, as subsequent launch calls will pick them up and bind again if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then @@ -113,11 +96,11 @@ if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then popd fi -# PHASE 6: testing through the gateway API (v2 SDK) -${CALL_METHOD} launch manager --caliper-workspace phase6 --caliper-flow-only-test +# PHASE 4: testing through the gateway API (v2 SDK) +${CALL_METHOD} launch manager --caliper-workspace phase4 --caliper-flow-only-test rc=$? if [[ ${rc} != 0 ]]; then - echo "Failed CI step 7"; + echo "Failed CI step 4"; dispose; exit ${rc}; fi @@ -138,19 +121,24 @@ if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then popd fi -# PHASE 7: testing through the peer gateway API (fabric-gateway SDK) -${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-test +# PHASE 5: testing through the peer gateway API (fabric-gateway SDK) +${CALL_METHOD} launch manager --caliper-workspace phase5 --caliper-flow-only-test rc=$? if [[ ${rc} != 0 ]]; then - echo "Failed CI step 8"; + echo "Failed CI step 5"; dispose; exit ${rc}; fi -# PHASE 8: just disposing of the network -${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-end +# PHASE 6: just disposing of the network +${CALL_METHOD} launch manager --caliper-workspace phase6 --caliper-flow-only-end rc=$? if [[ ${rc} != 0 ]]; then - echo "Failed CI step 9"; + 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/phase3/src/marbles/go/marbles.go b/packages/caliper-tests-integration/fabric_tests/src/marbles/go/marbles.go similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/go/marbles.go rename to packages/caliper-tests-integration/fabric_tests/src/marbles/go/marbles.go diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/go/metadata/statedb/couchdb/indexes/indexOwner.json b/packages/caliper-tests-integration/fabric_tests/src/marbles/go/metadata/statedb/couchdb/indexes/indexOwner.json similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/go/metadata/statedb/couchdb/indexes/indexOwner.json rename to packages/caliper-tests-integration/fabric_tests/src/marbles/go/metadata/statedb/couchdb/indexes/indexOwner.json diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/marbles.js b/packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/marbles.js rename to packages/caliper-tests-integration/fabric_tests/src/marbles/node/marbles.js diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/metadata/statedb/couchdb/indexes/indexOwner.json b/packages/caliper-tests-integration/fabric_tests/src/marbles/node/metadata/statedb/couchdb/indexes/indexOwner.json similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/metadata/statedb/couchdb/indexes/indexOwner.json rename to packages/caliper-tests-integration/fabric_tests/src/marbles/node/metadata/statedb/couchdb/indexes/indexOwner.json diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/package.json b/packages/caliper-tests-integration/fabric_tests/src/marbles/node/package.json similarity index 100% rename from packages/caliper-tests-integration/fabric_tests/phase3/src/marbles/node/package.json rename to packages/caliper-tests-integration/fabric_tests/src/marbles/node/package.json