Skip to content

Commit

Permalink
Merge pull request #617 from aklenik/examples-to-ci
Browse files Browse the repository at this point in the history
Add multi-phase Besu, Ethereum, FISCO-BCOS and Sawtooth tests to CI
  • Loading branch information
aklenik authored Oct 25, 2019
2 parents 14f5790 + d2614dd commit 5520b01
Show file tree
Hide file tree
Showing 96 changed files with 3,344 additions and 40 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ node_js:
- '8'
matrix:
include:
- env: BENCHMARK=composer
- env: BENCHMARK=fabric
- env: BENCHMARK=ethereum
- env: BENCHMARK=sawtooth
- env: BENCHMARK=besu
- env: BENCHMARK=fisco-bcos
dist: trusty
before_install: |
set -ev
Expand Down
4 changes: 2 additions & 2 deletions .travis/avoid_verdaccio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ npm i && npm run repoclean -- --yes && npm run bootstrap
npm test

# Call CLI directly
# The CWD will be in one of the caliper-tests-integration/*-tests directories
export CALL_METHOD="node ../caliper-cli/caliper.js"
# The CWD will be in one of the caliper-tests-integration/*_tests directories
export CALL_METHOD="node ../../caliper-cli/caliper.js"

echo "---- Running Integration test for adaptor ${BENCHMARK}"
cd ./packages/caliper-tests-integration/
Expand Down
13 changes: 2 additions & 11 deletions .travis/script.sh → .travis/use_verdaccio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,10 @@ npm i --registry http://localhost:4873 --only=prod @hyperledger/caliper-cli
# These are common for each scenario
export CALIPER_BIND_SDK=latest
export CALIPER_BIND_ARGS="--no-save"
export CALIPER_BIND_SUT="${BENCHMARK}"

echo "---- Binding CLI"
if [[ "${BENCHMARK}" == "composer" ]]; then
npx caliper bind --caliper-bind-sut composer
elif [[ "${BENCHMARK}" == "fabric" ]]; then
npx caliper bind --caliper-bind-sut fabric
elif [[ "${BENCHMARK}" == "ethereum" ]]; then
npx caliper bind --caliper-bind-sut ethereum
else
echo "Unknown target benchmark ${BENCHMARK}"
npm run cleanup
exit 1
fi
npx caliper bind

echo "---- Running Integration test for adaptor ${BENCHMARK}"
npm run run_tests
Expand Down
13 changes: 12 additions & 1 deletion packages/caliper-cli/lib/bind/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sut:
1.4.4: &fabric-latest
packages: ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]']
latest: *fabric-latest

sawtooth:
1.0.0:
packages: [ '[email protected]' ]
Expand All @@ -67,25 +68,35 @@ sut:
1.0.5: &sawtooth-latest
packages: [ '[email protected]' ]
latest: *sawtooth-latest

burrow:
0.23.0: &burrow-latest
packages: [ '@monax/[email protected]' ]
latest: *burrow-latest

iroha:
0.6.3: &iroha-latest
packages: [ '[email protected]' ]
latest: *iroha-latest

composer:
0.20.8: &composer-latest
packages: ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]' ]
settings:
- *new-node-old-grpc
latest: *composer-latest

fisco-bcos:
2.0.0: &fisco-latest
packages: ['[email protected]']
latest: *fisco-latest

ethereum:
1.2.1: &ethereum-latest
packages: ['[email protected].1']
packages: ['[email protected].0']
latest: *ethereum-latest

besu:
1.3.2: &besu-latest
packages: ['[email protected]']
latest: *besu-latest
2 changes: 1 addition & 1 deletion packages/caliper-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@hyperledger/caliper-sawtooth": "^0.1.0",
"@hyperledger/caliper-ethereum": "^0.1.0",
"@hyperledger/caliper-fisco-bcos": "^0.1.0",
"chalk": "1.1.3",
"chalk": "^1.1.3",
"yargs": "10.0.3"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-composer/lib/composer_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ async function joinChannels(config) {

// Collect Organisation peers
let peerNames = org.peers;
let peers = new Array();
let peers = [];
peerNames.forEach((peer) => {
peers.push(config.composer.network.peers[peer]);
});

if(!peers || peers.length === 0) {
if(peers.length === 0) {
return Promise.reject('No peers defined within org.config: unable to join peers to channel(s).');
}

Expand Down
3 changes: 2 additions & 1 deletion packages/caliper-core/lib/utils/benchmark-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class BenchmarkValidator {
}

// If prometheus monitor specified, must be a prometheus observer
if (benchConfig.monitor.type.includes('prometheus') && !(benchConfig.observer.type.localeCompare('prometheus') === 0) ) {
if (benchConfig.monitor && benchConfig.monitor.type &&
benchConfig.monitor.type.includes('prometheus') && !(benchConfig.observer.type.localeCompare('prometheus') === 0) ) {
BenchmarkValidator.throwIncompatibleTypeBenchmarkError('observer.type.local', 'monitor.type.prometheus');
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"src/comm/template/report.html"
],
"dependencies": {
"@hyperledger/caliper-core": "^0.1.0"
"@hyperledger/caliper-core": "0.1.0"
},
"devDependencies": {
"web3": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-fabric/lib/fabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ class Fabric extends BlockchainInterface {
}
});
} catch (err) {
new Error(`Couldn't join peers ${peersToJoin.toString()} to ${channelName}: ${err.message}`);
throw new Error(`Couldn't join peers ${peersToJoin.toString()} to ${channelName}: ${err.message}`);
}

if (errors.length > 0) {
Expand Down
3 changes: 2 additions & 1 deletion packages/caliper-sawtooth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
},
"dependencies": {
"@hyperledger/caliper-core": "0.1.0",
"request-promise": "^4.2.1"
"request-promise": "^4.2.1",
"protocol-buffers": "^4.1.0"
},
"devDependencies": {
"sawtooth-sdk": "^1.0.5",
Expand Down
2 changes: 2 additions & 0 deletions packages/caliper-tests-integration/besu_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.log
report.html
39 changes: 39 additions & 0 deletions packages/caliper-tests-integration/besu_tests/benchconfig.yaml
Original file line number Diff line number Diff line change
@@ -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:
clients:
type: local
number: 1
rounds:
- label: open
txNumber: [100]
rateControl: [{ type: 'fixed-rate', opts: { tps: 10 } }]
arguments:
money: 10000
callback: open.js
- label: query
txNumber: [200]
rateControl: [{ type: 'fixed-feedback-rate', opts: { tps: 10, unfinished_per_client: 5 } }]
callback: query.js
- label: transfer
txNumber: [100]
rateControl: [{ type: 'linear-rate', opts: { startingTps: 5, finishingTps: 20 } }]
arguments:
money: 10000
callback: transfer.js
observer:
interval: 1
type: local
48 changes: 48 additions & 0 deletions packages/caliper-tests-integration/besu_tests/caliper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# 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.json
workspace: ./
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,18 @@
#
# 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.
#

FROM hyperledger/besu:1.3.2
COPY ./data/ /root/
VOLUME [ "/root/.ethereum/keystore/" ]
ENTRYPOINT [ "/opt/besu/bin/besu", "--genesis-file=/root/genesis.json", "--node-private-key-file=/root/.ethereum/keystore/key" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"config": {
"chainId": 48122,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"constantinopleBlock": 5,
"clique": {
"blockperiodseconds": 5,
"epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x5ca916c6",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000c0A8e4D217eB85b812aeb1226fAb6F588943C2C20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2",
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"alloc": {
"0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# 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.
#

version: "3"
services:
node:
build:
context: .
dockerfile: caliper-besu-clique.Dockerfile
image: caliper-besu-clique
container_name: besu_clique
volumes:
- ./keys:/root/.ethereum/keystore
ports:
- 8545-8547:8545-8547
command: --revert-reason-enabled --rpc-http-enabled --rpc-http-host 0.0.0.0 --host-whitelist=* --rpc-http-apis admin,eth,miner,web3,net --graphql-http-enabled --discovery-enabled=false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xa67bee5d6fb43acd42e307eb67547ab5006ad2fbb9567829e9b4b2ef3580acea
22 changes: 22 additions & 0 deletions packages/caliper-tests-integration/besu_tests/networkconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"caliper": {
"blockchain": "ethereum",
"command" : {
"start": "docker-compose -f config/docker-compose.yml up -d && sleep 10",
"end" : "docker-compose -f config/docker-compose.yml down"
}
},
"ethereum": {
"url": "http://localhost:8545",
"contractDeployerAddress": "0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2",
"contractDeployerAddressPrivateKey": "0xa67bee5d6fb43acd42e307eb67547ab5006ad2fbb9567829e9b4b2ef3580acea",
"fromAddress": "0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2",
"fromAddressPrivateKey": "0xa67bee5d6fb43acd42e307eb67547ab5006ad2fbb9567829e9b4b2ef3580acea",
"transactionConfirmationBlocks": 2,
"contracts": {
"simple": {
"path": "src/simple/simple.json"
}
}
}
}
Loading

0 comments on commit 5520b01

Please sign in to comment.