diff --git a/packages/caliper-fabric/lib/connector-versions/peer-gateway/PeerGateway.js b/packages/caliper-fabric/lib/connector-versions/peer-gateway/PeerGateway.js index de5ac8c23..3cefc93d3 100644 --- a/packages/caliper-fabric/lib/connector-versions/peer-gateway/PeerGateway.js +++ b/packages/caliper-fabric/lib/connector-versions/peer-gateway/PeerGateway.js @@ -175,6 +175,7 @@ class PeerGateway extends ConnectorBase { client.close(); } + this.clients.clear(); this.context = undefined; } diff --git a/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml b/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml index 178471b2d..974509489 100644 --- a/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml +++ b/packages/caliper-tests-integration/fabric_tests/docker-compose.yaml @@ -24,7 +24,7 @@ services: ####### ca.org1.example.com: - image: hyperledger/fabric-ca:1.4.8 + 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 @@ -42,8 +42,9 @@ services: - ./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 + 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 @@ -67,7 +68,7 @@ services: orderer0.example.com: container_name: orderer0.example.com - image: hyperledger/fabric-orderer:1.4.8 + image: hyperledger/fabric-orderer:2.4.3 environment: - FABRIC_LOGGING_SPEC=info - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 @@ -80,9 +81,6 @@ services: - 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 @@ -107,7 +105,7 @@ services: orderer1.example.com: container_name: orderer1.example.com - image: hyperledger/fabric-orderer:1.4.8 + image: hyperledger/fabric-orderer:2.4.3 environment: - FABRIC_LOGGING_SPEC=info - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 @@ -120,9 +118,6 @@ services: - 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 @@ -151,7 +146,7 @@ services: peer0.org1.example.com: container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:1.4.8 + image: hyperledger/fabric-peer:2.4.3 environment: - FABRIC_LOGGING_SPEC=info - CORE_CHAINCODE_LOGGING_LEVEL=INFO @@ -169,14 +164,16 @@ services: # 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 - # 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 @@ -199,15 +196,18 @@ services: couchdb.peer0.org1.example.com: container_name: couchdb.peer0.org1.example.com - image: hyperledger/fabric-couchdb:0.4.14 + 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: - DB_URL: http://localhost:5984/member_db + - COUCHDB_USER=admin + - COUCHDB_PASSWORD=adminpw peer0.org2.example.com: container_name: peer0.org2.example.com - image: hyperledger/fabric-peer:1.4.8 + image: hyperledger/fabric-peer:2.4.3 environment: - FABRIC_LOGGING_SPEC=info - CORE_CHAINCODE_LOGGING_LEVEL=INFO @@ -225,14 +225,16 @@ services: # 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 - # 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 @@ -255,11 +257,14 @@ services: couchdb.peer0.org2.example.com: container_name: couchdb.peer0.org2.example.com - image: hyperledger/fabric-couchdb:0.4.14 + 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: - DB_URL: http://localhost:5984/member_db + - COUCHDB_USER=admin + - COUCHDB_PASSWORD=adminpw ############## # MONITORING # @@ -312,5 +317,4 @@ services: - "1883:1883" - "9001:9001" volumes: - - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf - + - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf \ No newline at end of file diff --git a/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml index 8e957b113..454b66115 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase2/networkconfig.yaml @@ -18,7 +18,7 @@ version: "2.0.0" caliper: blockchain: fabric sutOptions : - mutualTls: true + mutualTls: false channels: - channelName: mychannel diff --git a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml index 23b73c5aa..b3e7d48cc 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase3/networkconfig.yaml @@ -18,7 +18,7 @@ version: "2.0.0" caliper: blockchain: fabric sutOptions : - mutualTls: true + mutualTls: false channels: - channelName: mychannel diff --git a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml index 032fed899..d629bcd62 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase4/networkconfig.yaml @@ -18,7 +18,7 @@ version: "2.0.0" caliper: blockchain: fabric sutOptions : - mutualTls: true + mutualTls: false channels: - channelName: mychannel diff --git a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml index 032fed899..d629bcd62 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase5/networkconfig.yaml @@ -18,7 +18,7 @@ version: "2.0.0" caliper: blockchain: fabric sutOptions : - mutualTls: true + mutualTls: false channels: - channelName: mychannel diff --git a/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml index 032fed899..d629bcd62 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase6/networkconfig.yaml @@ -18,7 +18,7 @@ version: "2.0.0" caliper: blockchain: fabric sutOptions : - mutualTls: true + mutualTls: false channels: - channelName: mychannel diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml index eb610576e..9f40d3b92 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase7/benchconfig.yaml @@ -20,20 +20,64 @@ test: rounds: - label: init1 txNumber: 100 - rateControl: { type: 'fixed-rate', opts: { tps: 20 } } + rateControl: { type: 'fixed-load', opts: { "transactionLoad": 5, "startingTps": 100 }} workload: module: ./../init.js arguments: - marblePrefix: marbles_phase_5 - - label: init2 + marblePrefix: marbles_phase_7 + - label: query1 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 + module: ./queryByChannelNoTargetPeer.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_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: 5 + pushUrl: "http://localhost:9091" + resource: + - module: prometheus + options: + interval: 5 + 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/ccp-org1.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/ccp-org1.yaml new file mode 100644 index 000000000..1c3758a95 --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase7/ccp-org1.yaml @@ -0,0 +1,59 @@ +# +# 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 \ No newline at end of file diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/ccp-org2.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/ccp-org2.yaml new file mode 100644 index 000000000..48fddcb79 --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase7/ccp-org2.yaml @@ -0,0 +1,59 @@ +# +# 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 diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml index cc7ab138e..04725176a 100644 --- a/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml +++ b/packages/caliper-tests-integration/fabric_tests/phase7/networkconfig.yaml @@ -17,5 +17,39 @@ 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-* + 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' + + - 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' + diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/queryByChannelNoTagetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase7/queryByChannelNoTagetPeers.js new file mode 100644 index 000000000..6593f5402 --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase7/queryByChannelNoTagetPeers.js @@ -0,0 +1,62 @@ +/* +* 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. +*/ + +'use strict'; + +const { WorkloadModuleBase } = require('@hyperledger/caliper-core'); + +/** + * Workload module for querying the SUT for various marbles. + */ +class MarblesQueryByChannelWorkload extends WorkloadModuleBase { + /** + * Initializes the parameters of the marbles workload. + */ + constructor() { + super(); + this.txIndex = -1; + this.owners = ['Alice', 'Bob', 'Claire', 'David']; + } + + /** + * Assemble TXs for querying existing marbles based on their owners. + * @return {Promise} + */ + async submitTransaction() { + this.txIndex++; + let marbleOwner = this.owners[this.txIndex % this.owners.length]; + + let args = { + contractId: 'marbles', + contractVersion: 'v0', + channel: this.txIndex % 2 === 0 ? 'mychannel' : 'yourchannel', + contractFunction: 'queryMarblesByOwner', + contractArguments: [marbleOwner], + invokerIdentity: 'client0.org1.example.com', + timeout: 10 + }; + + await this.sutAdapter.sendRequests(args); + } +} + +/** + * Create a new instance of the workload module. + * @return {WorkloadModuleInterface} + */ +function createWorkloadModule() { + return new MarblesQueryByChannelWorkload(); +} + +module.exports.createWorkloadModule = createWorkloadModule; diff --git a/packages/caliper-tests-integration/fabric_tests/phase7/queryNoTargetPeers.js b/packages/caliper-tests-integration/fabric_tests/phase7/queryNoTargetPeers.js new file mode 100644 index 000000000..5565a7eac --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase7/queryNoTargetPeers.js @@ -0,0 +1,60 @@ +/* +* 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. +*/ + +'use strict'; + +const { WorkloadModuleBase } = require('@hyperledger/caliper-core'); + +/** + * Workload module for querying the SUT for various marbles. + */ +class MarblesQueryWorkload extends WorkloadModuleBase { + /** + * Initializes the parameters of the marbles workload. + */ + constructor() { + super(); + this.txIndex = -1; + this.owners = ['Alice', 'Bob', 'Claire', 'David']; + } + + /** + * Assemble TXs for querying existing marbles based on their owners. + * @return {Promise} + */ + async submitTransaction() { + this.txIndex++; + let marbleOwner = this.owners[this.txIndex % this.owners.length]; + + let args = { + contractId: this.txIndex % 2 === 0 ? 'mymarbles' : 'yourmarbles', + contractFunction: 'queryMarblesByOwner', + contractArguments: [marbleOwner], + invokerIdentity: 'client0.org1.example.com', + timeout: 10 + }; + + await this.sutAdapter.sendRequests(args); + } +} + +/** + * Create a new instance of the workload module. + * @return {WorkloadModuleInterface} + */ +function createWorkloadModule() { + return new MarblesQueryWorkload(); +} + +module.exports.createWorkloadModule = createWorkloadModule; diff --git a/packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml b/packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml new file mode 100644 index 000000000..eb610576e --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase8/benchconfig.yaml @@ -0,0 +1,39 @@ +# +# 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: + type: local + 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 new file mode 100644 index 000000000..cc7ab138e --- /dev/null +++ b/packages/caliper-tests-integration/fabric_tests/phase8/networkconfig.yaml @@ -0,0 +1,21 @@ +# +# 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/run.sh b/packages/caliper-tests-integration/fabric_tests/run.sh index 5ba36aab4..076ecb472 100755 --- a/packages/caliper-tests-integration/fabric_tests/run.sh +++ b/packages/caliper-tests-integration/fabric_tests/run.sh @@ -40,13 +40,9 @@ export CALIPER_PROJECTCONFIG=../caliper.yaml dispose () { docker ps -a - ${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-end + ${CALL_METHOD} launch manager --caliper-workspace phase8 --caliper-flow-only-end } -# needed, since the peer looks for the latest, which is no longer on dockerhub -docker pull hyperledger/fabric-ccenv:1.4.8 -docker image tag hyperledger/fabric-ccenv:1.4.8 hyperledger/fabric-ccenv:latest - # PHASE 1: just starting the network ${CALL_METHOD} launch manager --caliper-workspace phase1 --caliper-flow-only-start rc=$? @@ -126,10 +122,35 @@ if [[ ${rc} != 0 ]]; then exit ${rc}; fi -# PHASE 7: just disposing of the network -${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-end +# 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 + pushd $SUT_DIR + ${CALL_METHOD} unbind --caliper-bind-sut fabric:2.2 + popd +fi + +# BIND with 2.4 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 + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut fabric:2.4 + popd +fi + +# PHASE 7: testing through the peer gateway API (fabric-gateway SDK) +${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-test rc=$? if [[ ${rc} != 0 ]]; then echo "Failed CI step 8"; + dispose; + exit ${rc}; +fi + +# PHASE 8: just disposing of the network +${CALL_METHOD} launch manager --caliper-workspace phase7 --caliper-flow-only-end +rc=$? +if [[ ${rc} != 0 ]]; then + echo "Failed CI step 9"; exit ${rc}; fi