Scala Hyperledger API - Running Tests locally using the Production Network
February 23, 2021 ยท View on GitHub
Prerequisites
-
Have a working UC4-chaincode-network running (Checkout the hlf-network or alternatively fetch the latest network by executing
sh ./fetch_prod_network.sh)- Have faketime installed
sudo apt-get install faketime- Start the network by executing
./restart.sh -tof the hlf-network.
Note: use the testing flag to have the network create the testing identities. -
Set up the Environment Variables: The necessary variables with their concrete values which need to be exported are provided at the end of the output of the network start script. They look similar to these:
- find the Certificate Authority
export UC4_KIND_NODE_IP=172.17.0.2 - referencing the "connection_profile.yaml"
export UC4_CONNECTION_PROFILE=/tmp/hyperledger/connection_profile_kubernetes_local.yaml- describing what kind of Network you are using
export UC4_TESTBASE_TARGET=PRODUCTION_NETWORKThe given three export lines can simply be copied to the command line.
- find the Certificate Authority
Run the Tests :)
Run the tests from the hlf-api directory using:
sbt clean compile testOnly "*ApprovalTests *CertificateErrorTests"
Troubleshooting:
Without sbt clean, tests might fail without obvious reasons.