RNode Integration Testing Tool

Tests to run locally prior to each commit

Run this line locally from rchain project root before you do a PR. If there is a FAIL not all PASS at the end fix your code or fix the issue with the integrations test script. Jeremy Busk will be glad to help.

sudo sbt -Dsbt.log.noformat=true clean rholang/bnfc:generate casper/test:compile node/docker:publishLocal && sudo ./scripts/p2p-test-tool.py -b -t

The docker images stay up so you can login and run commands unless they fail via docker exec -it peer0.rchain.coop /bin/bash

You can always do docker logs bootstrap.rchain.coopdocker logs peer0.rchain.coop or docker logs peer1.rchain.coop to get logs after container failure and shutdown.

Getting Started with RChain P2P Networked Nodes Testing Tool 

Note: This is first release and will be getting updates soon. We'll be adding Python unittest library and refactoring for optimization and easier adding of tests.

The p2p-test-tool.py has been created in order to make testing RChain node(rnode) error free functionality easier.

By default this creates a standalone server to act as bootstrap server called bootstrap.rchain.coop and and two "peer nodes for testing.


Get going with the script with some simple steps.

  1. Does my machine have enough resources?
    1. 8GB RAM? If you have 4GB RAM on your machine this probably won't run. you could try running it with 512MB ram per node put it will be slow and might fail. You may even want to reboot machine before running to free you RAM.
  2. Get Python3.6
    1. The script requires Python3.6 to be installed. Most operating systems have an easy way to install this if you don't have it installed already.
      There is always Anaconda that installs on about anything. https://conda.io/docs/user-guide/install/download.html
  3. Install required python packages
  4. In order to build new image based off you code run sudo sbt -Dsbt.log.noformat=true clean rholang/bnfc:generate node/docker:publishLocal
    1. this creates a docker image available at coop.rchain/rnode:latest this is the default docker image for p2p-test-tool.py
  5. python3.6 -m pip install docker argparse pexpect
  6. run script with default image, alternate image and only 1 peer instead of default of two peers (bootstrap and 2 peers) 
    1. ./scripts/p2p-test-tool.py -b
    2. ./scripts/p2p-test-tool.py -b -i rchain/rnode:dev -p 1
  7. Login to bootstrap and a peer docker container to look at system, pull metrics with curl, run other java -jar commands:
    1. docker exec -it bootstrap.rchain.coop /bin/sh
    2. docker exec -ti peer0.rchain.coop /bin/sh
  8. If you are done with containers you can remove all resources associated with docker network space rchain.coop.
    1. ./scripts/p2p-test-tool.py -r
  9. For usage and help options run:
    1. ./scripts/p2p-test-tool.py -h

You should look for FAIL in summary results. If so you will need to find out why.

You can search for issues through docker log files that are dumped at the end of every run before summary results.
If on local machine you can run ./scripts/p2p-test-tool.py -l and all logs will be printed out for all peer nodes. You can grep to look for issues.

A successful run will complete with all passes like below.

=================TEST SUMMARY RESULTS======================
PASS: peer1.rchain.coop: Metrics API http/tcp/9095 is available.
PASS: peer0.rchain.coop: Metrics API http/tcp/9095 is available.
PASS: peer1.rchain.coop: Peers count correct in node logs.
PASS: peer0.rchain.coop: Peers count correct in node logs.
PASS: peer1.rchain.coop: Rholang evaluation of files performed correctly.
PASS: peer0.rchain.coop: Rholang evaluation of files performed correctly.
PASS: peer0.rchain.coop: REPL loader success!
PASS: peer1.rchain.coop: No errors defined by "ERROR" in logs.
PASS: peer0.rchain.coop: No errors defined by "ERROR" in logs.
PASS: peer1.rchain.coop: No text of "RuntimeException" in logs.
PASS: peer0.rchain.coop: No text of "RuntimeException" in logs.
PASS ALL: All tests successfully passed

Other common examples:

  • ./scripts/p2p-test-tool.py -t
    • run all tests again on current running containers
  • ./scripts/p2p-test-tool.py -t -T repl --repl-load-repetitions 100
    • only run REPL test with 100 repetitions in loop
  • ./scripts/p2p-test-tool.py -r
    • destroy all resources related to docker network name rchain.coop
  • ./scripts/p2p-test-tool.py -m 2048m -c 0,1,2,3 -b
    • boot network with 2G ram and 4 cpu cores.
  • ./scripts/p2p-test-tool.py -d
    • deploy casper demo on all running peer nodes

You're a pro now. Play around with things. It's docker!

Please add more  as needed.

More to come!.