tests: test for stopping node while it's starting.

In CI we see crashes in this case:

```
lightningd: lightningd/connect_control.c:734: void connectd_activate(struct lightningd *): Assertion `ret == ld->connectd' failed.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-06 09:46:16 +09:30
committed by Vincenzo Palazzo
parent efeb030eef
commit 30335e1dc3

View File

@@ -3237,3 +3237,23 @@ def test_create_gossip_mesh(node_factory, bitcoind):
print("nodeids", nodeids) print("nodeids", nodeids)
print("scids", scids) print("scids", scids)
assert False, "Test failed on purpose, grab the gossip store from /tmp/ltests-..." assert False, "Test failed on purpose, grab the gossip store from /tmp/ltests-..."
@pytest.mark.xfail(strict=True)
def test_fast_shutdown(node_factory):
l1 = node_factory.get_node(start=False)
l1.daemon.start(wait_for_initialized=False)
start_time = time.time()
# Keep trying until this succeeds (socket may not exist yet!)
while True:
if time.time() > start_time + TIMEOUT:
raise ValueError("Timeout while waiting for stop to work!")
try:
l1.rpc.stop()
except FileNotFoundError:
continue
except ConnectionRefusedError:
continue
break