diff --git a/.build/benchmark-integration-test-direct.sh b/.build/benchmark-integration-test-direct.sh index 48b0025b4..3c2efcfdc 100755 --- a/.build/benchmark-integration-test-direct.sh +++ b/.build/benchmark-integration-test-direct.sh @@ -20,13 +20,32 @@ set -o pipefail # Bootstrap the project again 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" +# Get the root directory of the caliper source +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +echo $ROOT_DIR + +# Call the CLI directly in the source tree +export CALL_METHOD="node $ROOT_DIR/packages/caliper-cli/caliper.js" # Use explicit binding for export BIND_IN_PACKAGE_DIR=true -export GENERATOR_METHOD="yo ../../../generator-caliper/generators/benchmark/index.js" + +# Call the Generator code directly from source +export GENERATOR_METHOD="yo $ROOT_DIR/packages/generator-caliper/generators/benchmark/index.js" + +# Create a directory outside of the source code tree to install SUT binding node modules +# We have to do this otherwise npm will attempt to hoist the npm modules to a directory +# which subsequently doesn't get searched +# This approach means we can drop having to declare dependencies on SUT bound modules in the +# connector and makes it more like the way a user would use caliper. +export SUT_DIR=$HOME/sut +echo $SUT_DIR +mkdir -p $SUT_DIR + +# Ensure node searches this directory by setting NODE_PATH +export NODE_PATH=$SUT_DIR/node_modules echo "---- Running Integration test for adaptor ${BENCHMARK}" cd ./packages/caliper-tests-integration/ ./run-tests.sh + +rm -fr $SUT_DIR diff --git a/packages/caliper-cli/lib/lib/config.yaml b/packages/caliper-cli/lib/lib/config.yaml index 3ba8fd176..495b9fa0b 100644 --- a/packages/caliper-cli/lib/lib/config.yaml +++ b/packages/caliper-cli/lib/lib/config.yaml @@ -52,8 +52,10 @@ sut: latest: *fisco-latest ethereum: - 1.2.1: ðereum-latest + 1.2.1: packages: ['web3@1.2.2'] + 1.3: ðereum-latest + packages: ['web3@1.3.0'] latest: *ethereum-latest besu: diff --git a/packages/caliper-ethereum/package.json b/packages/caliper-ethereum/package.json index 7dd959177..77f86851b 100644 --- a/packages/caliper-ethereum/package.json +++ b/packages/caliper-ethereum/package.json @@ -24,7 +24,6 @@ "dependencies": { "@hyperledger/caliper-core": "0.5.0-unstable", "ethereumjs-wallet": "^0.6.3", - "web3": "1.3.0", "web3-eea": "0.10.0" }, "devDependencies": { diff --git a/packages/caliper-fabric/package.json b/packages/caliper-fabric/package.json index 3b2e6232e..d1da3d5c8 100644 --- a/packages/caliper-fabric/package.json +++ b/packages/caliper-fabric/package.json @@ -27,9 +27,6 @@ "semver": "7.1.1" }, "devDependencies": { - "fabric-ca-client": "^1.4.19", - "fabric-client": "^1.4.19", - "fabric-network": "^1.4.19", "fabric-protos": "2.1.0", "chai": "^3.5.0", "chai-as-promised": "^7.1.1", diff --git a/packages/caliper-fisco-bcos/package.json b/packages/caliper-fisco-bcos/package.json index 6013d5e24..a9c2e0560 100644 --- a/packages/caliper-fisco-bcos/package.json +++ b/packages/caliper-fisco-bcos/package.json @@ -33,7 +33,6 @@ "uuid": "^3.3.2" }, "devDependencies": { - "web3": "0.20.7", "license-check-and-add": "2.3.6" }, "license-check-and-add-config": { diff --git a/packages/caliper-tests-integration/besu_tests/run.sh b/packages/caliper-tests-integration/besu_tests/run.sh index 327e45e0c..0a194d8a6 100755 --- a/packages/caliper-tests-integration/besu_tests/run.sh +++ b/packages/caliper-tests-integration/besu_tests/run.sh @@ -25,7 +25,9 @@ npm i # bind during CI tests, using the package dir as CWD # Note: do not use env variables for binding settings, as subsequent launch calls will pick them up and bind again if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then - ${CALL_METHOD} bind --caliper-bind-sut besu:latest --caliper-bind-cwd ./../../caliper-ethereum/ --caliper-bind-args="--no-save" + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut besu:latest + popd fi # change default settings (add config paths too) diff --git a/packages/caliper-tests-integration/ethereum_tests/run.sh b/packages/caliper-tests-integration/ethereum_tests/run.sh index cbf556408..d83d6e413 100755 --- a/packages/caliper-tests-integration/ethereum_tests/run.sh +++ b/packages/caliper-tests-integration/ethereum_tests/run.sh @@ -23,7 +23,9 @@ cd "${DIR}" # bind during CI tests, using the package dir as CWD # Note: do not use env variables for binding settings, as subsequent launch calls will pick them up and bind again if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then - ${CALL_METHOD} bind --caliper-bind-sut ethereum:latest --caliper-bind-cwd ./../../caliper-ethereum/ --caliper-bind-args="--no-save" + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut ethereum:latest + popd fi # change default settings (add config paths too) diff --git a/packages/caliper-tests-integration/fabric_tests/run.sh b/packages/caliper-tests-integration/fabric_tests/run.sh index e830c124a..5ba36aab4 100755 --- a/packages/caliper-tests-integration/fabric_tests/run.sh +++ b/packages/caliper-tests-integration/fabric_tests/run.sh @@ -30,7 +30,9 @@ cd ${DIR} # bind during CI tests, using the package dir as CWD # Note: do not use env variables for binding settings, as subsequent launch calls will pick them up and bind again if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then - ${CALL_METHOD} bind --caliper-bind-sut fabric:1.4 --caliper-bind-cwd ./../../caliper-fabric/ + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut fabric:1.4 + popd fi # change default settings (add config paths too) @@ -103,12 +105,16 @@ fi # 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 - ${CALL_METHOD} unbind --caliper-bind-sut fabric:1.4 --caliper-bind-cwd ./../../caliper-fabric/ --caliper-projectconfig ./caliper.yaml + pushd $SUT_DIR + ${CALL_METHOD} unbind --caliper-bind-sut fabric:1.4 + popd fi # BIND with 2.2 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 - ${CALL_METHOD} bind --caliper-bind-sut fabric:2.2 --caliper-bind-cwd ./../../caliper-fabric/ + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut fabric:2.2 + popd fi # PHASE 6: testing through the gateway API (v2 SDK) diff --git a/packages/caliper-tests-integration/fisco-bcos_tests/run.sh b/packages/caliper-tests-integration/fisco-bcos_tests/run.sh index dab85dae1..5022e5445 100755 --- a/packages/caliper-tests-integration/fisco-bcos_tests/run.sh +++ b/packages/caliper-tests-integration/fisco-bcos_tests/run.sh @@ -23,7 +23,9 @@ cd "${DIR}" # bind during CI tests, using the package dir as CWD # Note: do not use env variables for binding settings, as subsequent launch calls will pick them up and bind again if [[ "${BIND_IN_PACKAGE_DIR}" = "true" ]]; then - ${CALL_METHOD} bind --caliper-bind-sut fisco-bcos:latest --caliper-bind-cwd ./../../caliper-fisco-bcos/ --caliper-bind-args="--no-save" + pushd $SUT_DIR + ${CALL_METHOD} bind --caliper-bind-sut fisco-bcos:latest + popd fi # change default settings (add config paths too) diff --git a/packages/caliper-tests-integration/generator_tests/fabric/run.sh b/packages/caliper-tests-integration/generator_tests/fabric/run.sh index 8aa7ae0c0..ed7d4b8af 100755 --- a/packages/caliper-tests-integration/generator_tests/fabric/run.sh +++ b/packages/caliper-tests-integration/generator_tests/fabric/run.sh @@ -45,6 +45,10 @@ docker image tag hyperledger/fabric-ccenv:1.4.8 hyperledger/fabric-ccenv:latest ${GENERATOR_METHOD} -- --workspace 'myWorkspace' --contractId 'mymarbles' --contractVersion 'v0' --contractFunction 'queryMarblesByOwner' --contractArguments '["Alice"]' --workers 'marbles' --benchmarkName 'A name for the marbles benchmark' --benchmarkDescription 'A description for the marbles benchmark' --label 'A label for the round' --rateController 'fixed-rate' --txType 'txDuration' --txDuration 'marbles' # start network and run benchmark test cd ../ +# bind the sdk into the packages directory as it will search for it there, this ensures it doesn't contaminate real node_modules dirs (2.2 will work with a 1.4 fabric) +pushd $SUT_DIR +${CALL_METHOD} bind --caliper-bind-sut fabric:2.2 +popd ${CALL_METHOD} launch manager --caliper-workspace 'fabric/myWorkspace' --caliper-networkconfig 'networkconfig.yaml' --caliper-benchconfig 'benchmarks/config.yaml' --caliper-flow-skip-end rc=$? if [[ ${rc} != 0 ]]; then