Skip to content

Commit

Permalink
add integration test for peer gateway connector + updated docker comp…
Browse files Browse the repository at this point in the history
…ose for fabric 2.4 (#1310)

Signed-off-by: fraVlaca <ocsenarf@outlook.com>
  • Loading branch information
fraVlaca committed Apr 12, 2022
1 parent 9e736c0 commit 6fb76f2
Show file tree
Hide file tree
Showing 16 changed files with 451 additions and 47 deletions.
Expand Up @@ -175,6 +175,7 @@ class PeerGateway extends ConnectorBase {
client.close();
}

this.clients.clear();
this.context = undefined;
}

Expand Down
52 changes: 28 additions & 24 deletions packages/caliper-tests-integration/fabric_tests/docker-compose.yaml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 #
Expand Down Expand Up @@ -312,5 +317,4 @@ services:
- "1883:1883"
- "9001:9001"
volumes:
- ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf

- ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
Expand Up @@ -18,7 +18,7 @@ version: "2.0.0"
caliper:
blockchain: fabric
sutOptions :
mutualTls: true
mutualTls: false

channels:
- channelName: mychannel
Expand Down
Expand Up @@ -18,7 +18,7 @@ version: "2.0.0"
caliper:
blockchain: fabric
sutOptions :
mutualTls: true
mutualTls: false

channels:
- channelName: mychannel
Expand Down
Expand Up @@ -18,7 +18,7 @@ version: "2.0.0"
caliper:
blockchain: fabric
sutOptions :
mutualTls: true
mutualTls: false

channels:
- channelName: mychannel
Expand Down
Expand Up @@ -18,7 +18,7 @@ version: "2.0.0"
caliper:
blockchain: fabric
sutOptions :
mutualTls: true
mutualTls: false

channels:
- channelName: mychannel
Expand Down
Expand Up @@ -18,7 +18,7 @@ version: "2.0.0"
caliper:
blockchain: fabric
sutOptions :
mutualTls: true
mutualTls: false

channels:
- channelName: mychannel
Expand Down
Expand Up @@ -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']

@@ -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

0 comments on commit 6fb76f2

Please sign in to comment.