decred.org/dcrdex@v1.0.5/dex/testing/dcrdex/README.md (about) 1 # DCRDEX Test Harness 2 3 The harness is a collection of tmux scripts that collectively creates a 4 sandboxed environment for testing dex swap transactions. 5 6 ## Dependencies 7 8 The dcrdex harness depends on 2 other harnesses: [DCR Test Harness](../dcr/README.md) 9 and [BTC Simnet Test Harness](../btc/README.md) to run. 10 11 ## Using 12 13 The [DCR Test Harness](../dcr/README.md) and [BTC Simnet Test Harness](../btc/README.md) 14 must be running to use the dcrdex harness. 15 16 The dcrdex config file created and used by the harness sets 17 `pgdbname=dcrdex_simnet_test` and `rpclisten=127.0.0.1:17273`. 18 You can override these or set additional config opts by passing them as 19 arguments when executing the harness script e.g.: 20 21 ```sh 22 ./harness.sh --pgpass=dexpass # arguments will be passed verbatim to the dcrdex cmd 23 ``` 24 25 To persist the postgres db password to the harness' dcrdex.conf (ideal if using 26 the config file externally), set a `PG_PASS` env variable: 27 28 ```sh 29 PG_PASS=dexpass ./harness.sh # dcrdex.conf will include pgpass="${PG_PASS}" 30 ``` 31 32 You can also override the default markets' epoch duration (15000ms) by setting 33 an `EPOCH` env variable (lowest value allowed is 1000, unit is ms) 34 35 ```sh 36 EPOCH=20000 ./harness.sh # to set the epoch duration to 20000ms 37 ``` 38 39 The harness script will drop any existing `dcrdex_simnet_test` PostgreSQL db 40 and create a fresh database for the session. The script will also create a 41 markets.json file referencing dcr and btc node config files created by the 42 respective node harnesses; and start a dcrdex instance listening at 43 `127.0.0.1:17273` or any address you specify in cli args. 44 45 The rpc cert for the dcrdex instance will be created in `~/dextest/dcrdex/rpc.cert` 46 with the following content: 47 48 ``` 49 -----BEGIN CERTIFICATE----- 50 MIICpTCCAgagAwIBAgIQZMfxMkSi24xMr4CClCODrzAKBggqhkjOPQQDBDBJMSIw 51 IAYDVQQKExlkY3JkZXggYXV0b2dlbmVyYXRlZCBjZXJ0MSMwIQYDVQQDExp1YnVu 52 dHUtcy0xdmNwdS0yZ2ItbG9uMS0wMTAeFw0yMDA2MDgxMjM4MjNaFw0zMDA2MDcx 53 MjM4MjNaMEkxIjAgBgNVBAoTGWRjcmRleCBhdXRvZ2VuZXJhdGVkIGNlcnQxIzAh 54 BgNVBAMTGnVidW50dS1zLTF2Y3B1LTJnYi1sb24xLTAxMIGbMBAGByqGSM49AgEG 55 BSuBBAAjA4GGAAQApXJpVD7si8yxoITESq+xaXWtEpsCWU7X+8isRDj1cFfH53K6 56 /XNvn3G+Yq0L22Q8pMozGukA7KuCQAAL0xnuo10AecWBN0Zo2BLHvpwKkmAs71C+ 57 5BITJksqFxvjwyMKbo3L/5x8S/JmAWrZoepBLfQ7HcoPqLAcg0XoIgJjOyFZgc+j 58 gYwwgYkwDgYDVR0PAQH/BAQDAgKkMA8GA1UdEwEB/wQFMAMBAf8wZgYDVR0RBF8w 59 XYIadWJ1bnR1LXMtMXZjcHUtMmdiLWxvbjEtMDGCCWxvY2FsaG9zdIcEfwAAAYcQ 60 AAAAAAAAAAAAAAAAAAAAAYcEsj5QQYcEChAABYcQ/oAAAAAAAAAYPqf//vUPXDAK 61 BggqhkjOPQQDBAOBjAAwgYgCQgFMEhyTXnT8phDJAnzLbYRktg7rTAbTuQRDp1PE 62 jf6b2Df4DkSX7JPXvVi3NeBru+mnrOkHBUMqZd0m036aC4q/ZAJCASa+olu4Isx7 63 8JE3XB6kGr+s48eIFPtmq1D0gOvRr3yMHrhJe3XDNqvppcHihG0qNb0gyaiX18Cv 64 vF8Ti1x2vTkD 65 -----END CERTIFICATE----- 66 ``` 67 68 A `curl` script is created in `~/dextest/dcrdex/dexadm` for sending requests to 69 the DEX API e.g. `~/dextest/dcrdex/dexadm ping` or 70 `~/dextest/dcrdex/dexadm notifyall @path/to/file.txt`. 71 72 ## Harness control 73 74 To quit the harness, run `~/dextest/dcrdex/quit` from any terminal/tmux window, 75 or from within the tmux window, use ctrl+c to stop the running dcrdex instance 76 and then `tmux kill-session` (or `exit`) to exit the harness. 77 78 ## Dev Stuff 79 80 If things aren't looking right, you may need to look at the harness tmux window 81 to see errors. Examining the dcrdex logs to look for errors is usually a good 82 first debugging step. 83 84 An unfortunate issue that will pop up if you're fiddling with the script is 85 zombie dcrdex processes preventing the harness nodes from binding to the 86 specified ports. You'll have to manually hunt down the zombie PIDs and `kill` 87 them if this happens. 88 89 Don't forget that there may be tests that rely on the existing script's 90 specifics to function correctly. Changes must be tested throughout dcrdex.