From fb6ea54f1597a95c9c73a4e1b728fba6b77ea868 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Wed, 3 Jun 2020 11:04:22 +0100 Subject: [PATCH] Add tmux test harness. --- README.md | 17 +++++++ harness.sh | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100755 harness.sh diff --git a/README.md b/README.md index 09dff08..52eebaa 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,23 @@ requests, and a number of remote servers which host voting wallets. For more information about deploying vspd, check out [deployment.md](./docs/deployment.md). +## Development + +### Test Harness + +A test harness is provided in `harness.sh`. The test harness uses tmux to start +a testnet instance of dcrd, multiple dcrwallets, and finally vspd. Further +documentation can be found in [harness.sh](./harness.sh). + +### Web server debug mode + +The config option `--webserverdebug` will: + +- Force HTML templates to be reloaded on every web request. +- Reload the cached homepage data every second rather than every 5 minutes. +- Enable detailed webserver logging to the terminal (does not get written to log + file). + ## Issue Tracker The [integrated GitHub issue tracker](https://github.com/decred/vspd/issues) diff --git a/harness.sh b/harness.sh new file mode 100755 index 0000000..3c11078 --- /dev/null +++ b/harness.sh @@ -0,0 +1,134 @@ +#!/bin/bash + +# To use this test harness simply run `./harness.sh` from the repo root. +# +# This harness makes a few assumptions about the system it is running on: +# - tmux is installed +# - dcrd, dcrwallet and vspd are available on $PATH +# - Decred testnet chain is already downloaded and sync'd +# - dcrd transaction index is already built +# - The following files exist: +# - ${HOME}/.dcrd/rpc.cert +# - ${HOME}/.dcrd/rpc.key +# - ${HOME}/.dcrwallet/rpc.cert +# - ${HOME}/.dcrwallet/rpc.key + +set -e + +TMUX_SESSION="harness" +HARNESS_ROOT=~/harness +RPC_USER="user" +RPC_PASS="pass" +NUMBER_OF_WALLETS=3 + +DCRD_RPC_CERT="${HOME}/.dcrd/rpc.cert" +DCRD_RPC_KEY="${HOME}/.dcrd/rpc.key" + +WALLET_PASS="12345" +WALLET_RPC_CERT="${HOME}/.dcrwallet/rpc.cert" +WALLET_RPC_KEY="${HOME}/.dcrwallet/rpc.key" + +VSPD_FEE_XPUB="tpubVppjaMjp8GEWzpMGHdXNhkjqof8baKGkUzneNEiocnnjnjY9hQPe6mxzZQyzyKYS3u5yxLp8KrJvibqDzc75RGqzkv2JMPYDXmCRR1a39jg" + +if [ -d "${HARNESS_ROOT}" ]; then + rm -R "${HARNESS_ROOT}" +fi + +tmux new-session -d -s $TMUX_SESSION + +################################################# +# Setup dcrd. +################################################# + +tmux rename-window -t $TMUX_SESSION 'dcrd' + +echo "Writing config for dcrd" +mkdir -p "${HARNESS_ROOT}/dcrd" +cat > "${HARNESS_ROOT}/dcrd/dcrd.conf" < "${HARNESS_ROOT}/dcrwallet-${i}/dcrwallet.conf" < "${HARNESS_ROOT}/vspd/vspd.conf" <