Skip to content

Commit

Permalink
Integration test for benchmark generator
Browse files Browse the repository at this point in the history
Signed-off-by: lmuswere <[email protected]>
  • Loading branch information
lynn14m committed Jan 10, 2020
1 parent 2fccb88 commit c7c4bce
Show file tree
Hide file tree
Showing 20 changed files with 1,260 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
script: BENCHMARK=besu ./.travis/benchmark-integration-test-direct.sh
- name: FISCO-BCOS integration test
script: BENCHMARK=fisco-bcos ./.travis/benchmark-integration-test-direct.sh
- name: Generator integration test
script: BENCHMARK=generator ./.travis/benchmark-integration-test-direct.sh

# publish npm packages
- stage: npm publish
Expand Down
1 change: 1 addition & 0 deletions .travis/benchmark-integration-test-direct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ npm i && npm run repoclean -- --yes && npm run bootstrap
# Call CLI directly
# The CWD will be in one of the caliper-tests-integration/*_tests directories
export CALL_METHOD="node ../../caliper-cli/caliper.js"
export GENERATOR_METHOD="yo ../../../caliper-generator/generator-caliper/generators/benchmark/index.js"

echo "---- Running Integration test for adaptor ${BENCHMARK}"
cd ./packages/caliper-tests-integration/
Expand Down
1 change: 1 addition & 0 deletions .travis/benchmark-integration-test-verdaccio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ npm i && npm run repoclean -- --yes && npm run bootstrap

# Call CLI through the local binary
export CALL_METHOD="npx caliper"
export GENERATOR_METHOD="yo caliper:benchmark"

echo "---- Publishing packages locally"
cd ./packages/caliper-tests-integration/
Expand Down
Empty file modified packages/caliper-cli/caliper.js
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/*.log
report.html

**/myWorkspace/benchmarks
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"generator-caliper-benchmarks": {
"promptValues": {
"subgenerator": "benchmark"
},
"workspace": {}
},
"generator-caliper": {
"promptValues": {
"subgenerator": "benchmark"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# 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.
#

caliper:
benchconfig: benchconfig.yaml
networkconfig: networkconfig.yaml
report:
path: ../report.html
logging:
template: '%timestamp%%level%%module%%message%%metadata%'
formats:
timestamp: 'YYYY.MM.DD-HH:mm:ss.SSS ZZ'
label: false
json: false
pad: true
align: false
attributeformat:
level: ' %attribute%'
module: ' [%attribute%] '
metadata: ' (%attribute%)'
colorize:
all: true
colors:
info: green
error: red
warn: yellow
debug: grey
targets:
console:
target: console
enabled: true
options:
level: debug
file:
target: file
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin/*
config/*
crypto-config/*
genesis.block
mychannel.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# if the binaries are not available, download them
if [[ ! -d "bin" ]]; then
curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.1 1.4.1 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
Loading

0 comments on commit c7c4bce

Please sign in to comment.