Browse Source

tests: Add rudimentary integration test for Unix domain socket functionality

patch-4
yanmaani 3 years ago
parent
commit
82b9cd12eb
  1. 7
      electrum/tests/regtest.py
  2. 16
      electrum/tests/regtest/regtest.sh

7
electrum/tests/regtest.py

@ -34,6 +34,13 @@ class TestLightning(unittest.TestCase):
self.run_shell(['stop', agent])
class TestUnixSockets(TestLightning):
agents = []
def test_unixsockets(self):
self.run_shell(['unixsockets'])
class TestLightningAB(TestLightning):
agents = ['alice', 'bob']

16
electrum/tests/regtest/regtest.sh

@ -356,3 +356,19 @@ if [[ $1 == "watchtower" ]]; then
echo "watchtower publishes justice transaction"
wait_until_spent $ctx_id 1 # alice's to_local gets punished immediately
fi
if [[ $1 == "unixsockets" ]]; then
# This looks different because it has to run the entire daemon
# Test domain socket behavior
./run_electrum --regtest daemon -d --rpcsock=unix # Start daemon with unix domain socket
./run_electrum --regtest stop # Errors if it can't connect
# Test custom socket path
f=$(mktemp --dry-run)
./run_electrum --regtest daemon -d --rpcsock=unix --rpcsockpath=$f
[ -S $f ] # filename exists and is socket
./run_electrum --regtest stop
rm $f # clean up
# Test for regressions in the ordinary TCP functionality.
./run_electrum --regtest daemon -d --rpcsock=tcp
./run_electrum --regtest stop
fi

Loading…
Cancel
Save