diff --git a/.gitignore b/.gitignore index 261623b..0783f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ miniircd/ nums_basepoints.txt schedulefortesting scripts/commitmentlist +tmp/ diff --git a/conftest.py b/conftest.py index 00d3262..de4443d 100644 --- a/conftest.py +++ b/conftest.py @@ -32,11 +32,16 @@ def local_command(command, bg=False, redirect=''): #it doesn't matter 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): parser.addoption("--btcroot", action="store", default='', help="the fully qualified path to the directory containing "+\ "the bitcoin binaries, e.g. /home/user/bitcoin/bin/") parser.addoption("--btcconf", action="store", + default=os.path.join(root_path(), 'test/bitcoin.conf'), help="the fully qualified path to the location of the "+\ "bitcoin configuration file you use for testing, e.g. "+\ "/home/user/.bitcoin/bitcoin.conf") @@ -72,6 +77,8 @@ def setup(request): global bitcoin_conf, bitcoin_path, bitcoin_rpcpassword, bitcoin_rpcusername bitcoin_path = request.config.getoption("--btcroot") bitcoin_conf = request.config.getoption("--btcconf") + print("Here is the bitcoin_conf path:") + print(bitcoin_conf) bitcoin_rpcpassword = request.config.getoption("--btcpwd") bitcoin_rpcusername = request.config.getoption("--btcuser") diff --git a/docs/TESTING.md b/docs/TESTING.md index c09dbb9..f9a6b49 100644 --- a/docs/TESTING.md +++ b/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) -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 Install the test requirements (still in your virtualenv as mentioned above): pip install -r requirements-dev.txt -Curl is also needed: - - sudo apt-get install curl - 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 -copy the regtest_joinmarket.cfg file from the test/ directory to the root directory, -both files will need minor edits for your btc configuration). +(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). ### 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 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 keep the logging level at the default `INFO` only a minimum amount will come out, if diff --git a/test/bitcoin.conf b/test/bitcoin.conf index ca22075..8f66cb9 100644 --- a/test/bitcoin.conf +++ b/test/bitcoin.conf @@ -1,5 +1,2 @@ rpcuser=bitcoinrpc 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 - diff --git a/test/regtest_joinmarket.cfg b/test/regtest_joinmarket.cfg index 48c4fc5..49fbfe2 100644 --- a/test/regtest_joinmarket.cfg +++ b/test/regtest_joinmarket.cfg @@ -13,6 +13,7 @@ rpc_port = 18332 rpc_user = bitcoinrpc rpc_password = 123456abcdef network = testnet + [MESSAGING] host = localhost, localhost hostid = localhost1, localhost2 @@ -22,6 +23,7 @@ usessl = false, false socks5 = false, false socks5_host = localhost, localhost socks5_port = 9150, 9150 + [POLICY] # for dust sweeping, try merge_algorithm = gradual # for more rapid dust sweeping, try merge_algorithm = greedy