还有问题,调试中。。。。。
背景
caliper 支持的burrow最新版本为0.23.0,而现在最新的版本为0.30.2,不能支持新版本的测试
下载源码
git clone https://github.com/hyperledger/caliper.git
cd caliper
修改源码
packages/caliper-burrow/package.json
"devDependencies": {
"@hyperledger/burrow": "0.30.2",
"chai": "^3.5.0",
"eslint": "^5.16.0",
"mocha": "3.4.2",
"nyc": "11.1.0",
"rewire": "^4.0.0",
"sinon": "^7.3.2",
"license-check-and-add": "2.3.6"
}
packages/caliper-burrow/lib/burrow.js
const monax = require('@hyperledger/burrow');
packages/caliper-cli/lib/lib/config.yaml
burrow:
0.23.0:
packages: [ '@monax/[email protected]' ]
0.30.2: &burrow-latest
packages: [ '@hyperledger/[email protected]' ]
latest: *burrow-latest
安装依赖
npm i && npm run repoclean -- --yes && npm run bootstrap
npm i:安装开发时依赖项,例如Lerna和许可证检查包。
npm run repoclean:清理node_modules存储库中所有软件包的目录。新克隆的存储库不需要。
npm run bootstrap:在存储库中安装所有软件包的依赖关系,并链接这些软件包之间的任何交叉依赖关系
测试代码
目前仓库没有burrow的集成测试用例
BENCHMARK=fabric ./.travis/benchmark-integration-test-direct.sh
启动私有仓库
要设置和启动本地Verdaccio服务器,只需运行以下命令
cd ./packages/caliper-publish
./publish.js verdaccio start
Verdaccio服务器现在正在侦听以下地址: http://localhost:4873
发布软件包到私有仓库
./publish.js npm --registry "http://localhost:4873"
[NPM PUBLISH] Published package @hyperledger/[email protected]
记录下版本号
下载测试用例及初始化仓库
测试用例源码参考:https://blog.csdn.net/kk3909/article/details/105490642
初始化仓库
cd caliper-benchmarks/
npm init -y
npm install --registry=http://localhost:4873 --only=prod \
@hyperledger/[email protected]
运行测试用例
修改networks/burrow/simple/docker-compose.yml,镜像版本号为v0.30.2
npx caliper launch master \
--caliper-bind-sut burrow:0.30.2 \
--caliper-workspace . \
--caliper-benchconfig benchmarks/scenario/simple/config.yaml\
--caliper-networkconfig networks/burrow/simple/burrow.json
修改代码后重新测试
cd caliper
cp packages/caliper-burrow/package.json packages/caliper-burrow/package.json_bak
git checkout packages/caliper-sawtooth/package.json packages/caliper-iroha/package.json packages/caliper-fisco-bcos/package.json packages/caliper-fabric/package.json packages/caliper-ethereum/package.json packages/caliper-cli/package.json packages/caliper-cli/package.json packages/caliper-core/package.json packages/caliper-burrow/package.json
rm -rf node_modules/ package-lock.json
npm i && npm run repoclean -- --yes && npm run bootstrap
cp packages/caliper-burrow/package.json_bak packages/caliper-burrow/package.json
npm i && npm run repoclean -- --yes && npm run bootstrap
./packages/caliper-publish/publish.js npm --registry "http://localhost:4873"
cd caliper-benchmarks
rm -rf node_modules/ package-lock.json
npm init -y
## caliper-cli的版本为上一步发布的
npm install --registry=http://localhost:4873 --only=prod @hyperledger/[email protected]
npm install google-protobuf
npx caliper launch master \
--caliper-bind-sut burrow:0.30.2 \
--caliper-workspace . \
--caliper-benchconfig benchmarks/scenario/simple/config.yaml\
--caliper-networkconfig networks/burrow/simple/burrow.json
遇到的问题
- 执行
npx caliper launch master...
的时候报错
Error: Module "@hyperledger/caliper-burrow" could not be loaded: Error: Cannot find module 'google-protobuf'
安装一下依赖即可解决
npm install --save google-protobuf
- mac 下执行
npm i && npm run repoclean -- --yes && npm run bootstrap
报错
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
执行以下命令
sudo xcode-select --switch /Library/Developer/CommandLineTools