Browse Source

Default regtest bitcoin conf to test/bitcoin.conf

Use relative paths when setting btcconf default filepath

Whitespace and newlines

Must specify return value in python

os.path.join preferred over str +

Also adding some print statements.
master
mecampbellsoup 8 years ago
parent
commit
428cc75675
  1. 1
      .gitignore
  2. 7
      conftest.py
  3. 15
      docs/TESTING.md
  4. 3
      test/bitcoin.conf
  5. 2
      test/regtest_joinmarket.cfg

1
.gitignore vendored

@ -20,3 +20,4 @@ miniircd/
nums_basepoints.txt nums_basepoints.txt
schedulefortesting schedulefortesting
scripts/commitmentlist scripts/commitmentlist
tmp/

7
conftest.py

@ -32,11 +32,16 @@ def local_command(command, bg=False, redirect=''):
#it doesn't matter #it doesn't matter
return subprocess.check_output(command) return subprocess.check_output(command)
def root_path():
# returns the directory in which this file is contained
return os.path.dirname(os.path.realpath(__file__))
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--btcroot", action="store", default='', parser.addoption("--btcroot", action="store", default='',
help="the fully qualified path to the directory containing "+\ help="the fully qualified path to the directory containing "+\
"the bitcoin binaries, e.g. /home/user/bitcoin/bin/") "the bitcoin binaries, e.g. /home/user/bitcoin/bin/")
parser.addoption("--btcconf", action="store", parser.addoption("--btcconf", action="store",
default=os.path.join(root_path(), 'test/bitcoin.conf'),
help="the fully qualified path to the location of the "+\ help="the fully qualified path to the location of the "+\
"bitcoin configuration file you use for testing, e.g. "+\ "bitcoin configuration file you use for testing, e.g. "+\
"/home/user/.bitcoin/bitcoin.conf") "/home/user/.bitcoin/bitcoin.conf")
@ -72,6 +77,8 @@ def setup(request):
global bitcoin_conf, bitcoin_path, bitcoin_rpcpassword, bitcoin_rpcusername global bitcoin_conf, bitcoin_path, bitcoin_rpcpassword, bitcoin_rpcusername
bitcoin_path = request.config.getoption("--btcroot") bitcoin_path = request.config.getoption("--btcroot")
bitcoin_conf = request.config.getoption("--btcconf") bitcoin_conf = request.config.getoption("--btcconf")
print("Here is the bitcoin_conf path:")
print(bitcoin_conf)
bitcoin_rpcpassword = request.config.getoption("--btcpwd") bitcoin_rpcpassword = request.config.getoption("--btcpwd")
bitcoin_rpcusername = request.config.getoption("--btcuser") bitcoin_rpcusername = request.config.getoption("--btcuser")

15
docs/TESTING.md

@ -2,25 +2,20 @@
This is a rough sketch, some more background is found in [JM wiki](https://github.com/Joinmarket-Org/joinmarket/wiki/Testing) This is a rough sketch, some more background is found in [JM wiki](https://github.com/Joinmarket-Org/joinmarket/wiki/Testing)
Make sure to have bitcoind installed. Also need miniircd installed to the root dir: Make sure to have [bitcoind](https://bitcoin.org/en/full-node) installed. Also need miniircd installed to the root (i.e. in your `joinmarket-clientserver` directory):
cd ~/joinmarket-clientserver
git clone https://github.com/Joinmarket-Org/miniircd git clone https://github.com/Joinmarket-Org/miniircd
Install the test requirements (still in your virtualenv as mentioned above): Install the test requirements (still in your virtualenv as mentioned above):
pip install -r requirements-dev.txt pip install -r requirements-dev.txt
Curl is also needed:
sudo apt-get install curl
Running the test suite should be done like: Running the test suite should be done like:
python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcroot=/path/to/bitcoin/bin/ --btcpwd=123456abcdef --btcconf=/path/to/bitcoin.conf --nirc=2 python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcpwd=123456abcdef --nirc=2
(you'll first want to copy bitcoin.conf in the test/ directory to a place you choose, and (you'll first want to copy the regtest_joinmarket.cfg file from the test/ directory to the root directory, this file will need minor edits for your btc configuration).
copy the regtest_joinmarket.cfg file from the test/ directory to the root directory,
both files will need minor edits for your btc configuration).
### Running tests of sendpayment and tumbler (including with malicious makers) ### Running tests of sendpayment and tumbler (including with malicious makers)
@ -28,7 +23,7 @@ The file `test/ygrunner.py` provides the ability to spin up a set of yieldgenera
bots against the local IRC instance with the local regtest blockchain. It can be bots against the local IRC instance with the local regtest blockchain. It can be
started with started with
py.test --btcroot=/path/to/bitcoin/bin/ --btcpwd=123456abcdef --btcconf=/path/to/bitcoin.conf --nirc=2 test/ygrunner.py -s py.test --btcroot=/path/to/bitcoin/bin/ --btcpwd=123456abcdef --nirc=2 test/ygrunner.py -s
Here the `-s` flag is useful because it prints log output to the console. If you Here the `-s` flag is useful because it prints log output to the console. If you
keep the logging level at the default `INFO` only a minimum amount will come out, if keep the logging level at the default `INFO` only a minimum amount will come out, if

3
test/bitcoin.conf

@ -1,5 +1,2 @@
rpcuser=bitcoinrpc rpcuser=bitcoinrpc
rpcpassword=123456abcdef rpcpassword=123456abcdef
walletnotify=/usr/bin/wget -q --spider --timeout=0.5 --tries=1 http://localhost:62612/walletnotify?%s
alertnotify=/usr/bin/wget -q --spider --timeout=0.5 --tries=1 http://localhost:62612/alertnotify?%s

2
test/regtest_joinmarket.cfg

@ -13,6 +13,7 @@ rpc_port = 18332
rpc_user = bitcoinrpc rpc_user = bitcoinrpc
rpc_password = 123456abcdef rpc_password = 123456abcdef
network = testnet network = testnet
[MESSAGING] [MESSAGING]
host = localhost, localhost host = localhost, localhost
hostid = localhost1, localhost2 hostid = localhost1, localhost2
@ -22,6 +23,7 @@ usessl = false, false
socks5 = false, false socks5 = false, false
socks5_host = localhost, localhost socks5_host = localhost, localhost
socks5_port = 9150, 9150 socks5_port = 9150, 9150
[POLICY] [POLICY]
# for dust sweeping, try merge_algorithm = gradual # for dust sweeping, try merge_algorithm = gradual
# for more rapid dust sweeping, try merge_algorithm = greedy # for more rapid dust sweeping, try merge_algorithm = greedy

Loading…
Cancel
Save