From 8da361b49b4a989d3a9ed16bb1151e7c9effe4a4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 26 Jul 2022 13:42:03 +0930 Subject: [PATCH] pytest: fix flake in test_channel_persistence w/ TEST_CHECK_DBSTMTS This was weird. Here is the message (with \n turned into real new lines): ``` 2022-07-24T07:20:08.9144998Z Plugin '/home/runner/work/lightning/lightning/tests/plugins/dblog.py' returned an invalid response to the db_write hook: {"jsonrpc": "2.0", "id": 40, "error": {"code": -32600, "message": "Error while processing db_write: UNIQUE constraint failed: shachain_known.shachain_id, shachain_known.pos", "traceback": "Traceback (most recent call last): File \"/home/runner/work/lightning/lightning/contrib/pyln-client/pyln/client/plugin.py\", line 631, in _dispatch_request result = self._exec_func(method.func, request) File \"/home/runner/work/lightning/lightning/contrib/pyln-client/pyln/client/plugin.py\", line 616, in _exec_func return func(*ba.args, **ba.kwargs) File \"/home/runner/work/lightning/lightning/tests/plugins/dblog.py\", line 45, in db_write plugin.conn.execute(c) sqlite3.IntegrityError: UNIQUE constraint failed: shachain_known.shachain_id, shachain_known.pos "}} ``` Finally, I realized that we *kill* l2: this means it has updated the plugin db but not the real db. This is expected: a real backup plugin would handle this case. Simply disable the test for this case. Signed-off-by: Rusty Russell --- tests/test_connection.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index 53c08223c..8d867a8af 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -2203,6 +2203,8 @@ def test_funding_while_offline(node_factory, bitcoind): @pytest.mark.developer @pytest.mark.openchannel('v1') @pytest.mark.openchannel('v2') +@unittest.skipIf(os.environ.get("TEST_CHECK_DBSTMTS", None) == "1", + "We kill l2, dblog plugin replay will be unreliable") def test_channel_persistence(node_factory, bitcoind, executor): # Start two nodes and open a channel (to remember). l2 will # mysteriously die while committing the first HTLC so we can