Skip to content

Commit 9b8bb9d

Browse files
committed
Skip incompatible tests based on hsmd daemon name prefix
This allows tests to be skipped for multiple named variations (`remote_hsmd*`), including the "Greenlight" PoC (`remote_hsmd_greenlight` symlink to the Rust implementation) This also avoids the test harness trying to launch `remote_hsmd` when `lightningd` is a more appropriate launcher.
1 parent 3e5fa8e commit 9b8bb9d

File tree

8 files changed

+50
-50
lines changed

8 files changed

+50
-50
lines changed

tests/test_closing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ def test_channel_lease_lessee_cheat(node_factory, bitcoind, chainparams):
10921092

10931093
@pytest.mark.developer("needs DEVELOPER=1")
10941094
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db")
1095-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't sign revoked commitment number")
1095+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't sign revoked commitment number")
10961096
@pytest.mark.slow_test
10971097
def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
10981098
""" Test that the penalizing node claims any published
@@ -1226,7 +1226,7 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
12261226

12271227
@pytest.mark.developer("needs DEVELOPER=1")
12281228
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db")
1229-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't sign revoked commitment number")
1229+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't sign revoked commitment number")
12301230
@pytest.mark.slow_test
12311231
def test_penalty_htlc_tx_timeout(node_factory, bitcoind, chainparams):
12321232
""" Test that the penalizing node claims any published
@@ -2822,7 +2822,7 @@ def test_permfail_htlc_out(node_factory, bitcoind, executor):
28222822

28232823

28242824
@pytest.mark.developer("needs DEVELOPER=1")
2825-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't withdraw to non-wallet address")
2825+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't withdraw to non-wallet address")
28262826
def test_permfail(node_factory, bitcoind):
28272827
l1, l2 = node_factory.line_graph(2)
28282828

@@ -2927,7 +2927,7 @@ def test_shutdown(node_factory):
29272927

29282928
@flaky
29292929
@pytest.mark.developer("needs to set upfront_shutdown_script")
2930-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy failure: validate_mutual_close_tx: holder_script doesn't match upfront holder_shutdown_script")
2930+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy failure: validate_mutual_close_tx: holder_script doesn't match upfront holder_shutdown_script")
29312931
def test_option_upfront_shutdown_script(node_factory, bitcoind, executor):
29322932
# There's a workaround in channeld, that it treats incoming errors
29332933
# before both sides are locked in as warnings; this happens in
@@ -3084,7 +3084,7 @@ def test_segwit_shutdown_script(node_factory, bitcoind, executor):
30843084
l1.rpc.fundchannel(l2.info['id'], 10**6)
30853085

30863086

3087-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remotesigner won't sign close w/ wrong txid")
3087+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remotesigner won't sign close w/ wrong txid")
30883088
@pytest.mark.openchannel('v1')
30893089
def test_shutdown_alternate_txid(node_factory, bitcoind):
30903090
l1, l2 = node_factory.line_graph(2, fundchannel=False,

tests/test_connection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def test_disconnect_fundee(node_factory):
392392
@pytest.mark.developer
393393
@pytest.mark.openchannel('v2')
394394
@unittest.skipIf(os.getenv('SUBDAEMON', 'xxx') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
395-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
395+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dual-funding yet")
396396
def test_disconnect_fundee_v2(node_factory):
397397
# Now error on fundee side during channel open, with them funding
398398
disconnects = ['-WIRE_ACCEPT_CHANNEL2',
@@ -595,7 +595,7 @@ def test_reconnect_no_update(node_factory, executor, bitcoind):
595595
l1.daemon.wait_for_log(r"CLOSINGD_COMPLETE")
596596

597597

598-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't like hsm_secret shenanigans")
598+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't like hsm_secret shenanigans")
599599
def test_connect_stresstest(node_factory, executor):
600600
# This test is unreliable, but it's better than nothing.
601601
l1, l2, l3 = node_factory.get_nodes(3, opts={'may_reconnect': True})
@@ -1044,7 +1044,7 @@ def test_funding_toolarge(node_factory, bitcoind):
10441044

10451045
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
10461046
@pytest.mark.openchannel('v2')
1047-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
1047+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dual-funding yet")
10481048
def test_v2_open(node_factory, bitcoind, chainparams):
10491049
l1, l2 = node_factory.get_nodes(2)
10501050

@@ -1501,7 +1501,7 @@ def test_funding_v2_cancel_race(node_factory, bitcoind, executor):
15011501
@pytest.mark.openchannel('v1')
15021502
@pytest.mark.openchannel('v2')
15031503
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
1504-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd can't handle random external addresses (allowlist)")
1504+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd can't handle random external addresses (allowlist)")
15051505
def test_funding_close_upfront(node_factory, bitcoind):
15061506
opts = {'plugin': os.path.join(os.getcwd(), 'tests/plugins/openchannel_hook_accepter.py')}
15071507

@@ -1644,7 +1644,7 @@ def test_funding_external_wallet(node_factory, bitcoind):
16441644

16451645
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
16461646
@pytest.mark.openchannel('v1') # We manually turn on dual-funding for select nodes
1647-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
1647+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dual-funding yet")
16481648
def test_multifunding_v1_v2_mixed(node_factory, bitcoind):
16491649
'''
16501650
Simple test for multifundchannel, using v1 + v2
@@ -1686,7 +1686,7 @@ def test_multifunding_v1_v2_mixed(node_factory, bitcoind):
16861686

16871687
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
16881688
@pytest.mark.openchannel('v2')
1689-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
1689+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dual-funding yet")
16901690
def test_multifunding_v2_exclusive(node_factory, bitcoind):
16911691
'''
16921692
Simple test for multifundchannel, using v2
@@ -2634,7 +2634,7 @@ def mock_sendrawtransaction(r):
26342634

26352635

26362636
@pytest.mark.developer("needs dev_fail")
2637-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't withdraw to non-wallet address")
2637+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't withdraw to non-wallet address")
26382638
def test_no_fee_estimate(node_factory, bitcoind, executor):
26392639
l1 = node_factory.get_node(start=False, options={'dev-no-fake-fees': True})
26402640

@@ -3093,7 +3093,7 @@ def test_fail_unconfirmed(node_factory, bitcoind, executor):
30933093
@pytest.mark.developer("need dev-disconnect")
30943094
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
30953095
@pytest.mark.openchannel('v2')
3096-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dual-funding yet")
3096+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dual-funding yet")
30973097
def test_fail_unconfirmed_openchannel2(node_factory, bitcoind, executor):
30983098
"""Test that if we crash with an unconfirmed connection to a known
30993099
peer, we don't have a dangling peer in db"""
@@ -3382,7 +3382,7 @@ def test_channel_features(node_factory, bitcoind):
33823382

33833383

33843384
@pytest.mark.developer("need dev-force-features")
3385-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support non-option_static_remotekey")
3385+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support non-option_static_remotekey")
33863386
def test_nonstatic_channel(node_factory, bitcoind):
33873387
"""Smoke test for a channel without option_static_remotekey"""
33883388
l1, l2 = node_factory.line_graph(2,

tests/test_db.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_max_channel_id(node_factory, bitcoind):
133133
@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db")
134134
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot")
135135
@unittest.skipIf(TEST_NETWORK != 'regtest', "The network must match the DB snapshot")
136-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't like channel_nonce changing")
136+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't like channel_nonce changing")
137137
def test_scid_upgrade(node_factory, bitcoind):
138138
bitcoind.generate_block(1)
139139

@@ -147,7 +147,7 @@ def test_scid_upgrade(node_factory, bitcoind):
147147
@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db")
148148
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot")
149149
@unittest.skipIf(TEST_NETWORK != 'regtest', "The network must match the DB snapshot")
150-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't like channel_nonce changing")
150+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't like channel_nonce changing")
151151
def test_last_tx_inflight_psbt_upgrade(node_factory, bitcoind):
152152
bitcoind.generate_block(12)
153153

@@ -170,7 +170,7 @@ def test_last_tx_inflight_psbt_upgrade(node_factory, bitcoind):
170170
@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db")
171171
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot")
172172
@unittest.skipIf(TEST_NETWORK != 'regtest', "The network must match the DB snapshot")
173-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't like channel_nonce changing")
173+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't like channel_nonce changing")
174174
def test_last_tx_psbt_upgrade(node_factory, bitcoind):
175175
bitcoind.generate_block(12)
176176

@@ -207,7 +207,7 @@ def test_last_tx_psbt_upgrade(node_factory, bitcoind):
207207

208208
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot")
209209
@unittest.skipIf(TEST_NETWORK != 'regtest', "The network must match the DB snapshot")
210-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support backfill yet")
210+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support backfill yet")
211211
def test_backfill_scriptpubkeys(node_factory, bitcoind):
212212
bitcoind.generate_block(214)
213213

@@ -334,7 +334,7 @@ def get_dsn(self):
334334
os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3',
335335
"This test is based on a sqlite3 snapshot"
336336
)
337-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support DB migration")
337+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support DB migration")
338338
def test_local_basepoints_cache(bitcoind, node_factory):
339339
"""XXX started caching the local basepoints as well as the remote ones.
340340

tests/test_misc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def is_p2wpkh(output):
497497
assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
498498

499499

500-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't withdraw to non-wallet address")
500+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't withdraw to non-wallet address")
501501
def test_withdraw_misc(node_factory, bitcoind, chainparams):
502502
def dont_spend_outputs(n, txid):
503503
"""Reserve both outputs (we assume there are two!) in case any our ours, so we don't spend change: wrecks accounting checks"""
@@ -1082,7 +1082,7 @@ def test_cli(node_factory):
10821082
assert [l for l in lines if not re.search(r'^help\[[0-9]*\].', l)] == ['format-hint=simple']
10831083

10841084

1085-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd integration test job control fails here")
1085+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd integration test job control fails here")
10861086
def test_daemon_option(node_factory):
10871087
"""
10881088
Make sure --daemon at least vaguely works!
@@ -1117,7 +1117,7 @@ def test_daemon_option(node_factory):
11171117

11181118
@flaky
11191119
@pytest.mark.developer("needs DEVELOPER=1")
1120-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't have repeatable random seeding")
1120+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't have repeatable random seeding")
11211121
def test_blockchaintrack(node_factory, bitcoind):
11221122
"""Check that we track the blockchain correctly across reorgs
11231123
"""
@@ -1610,7 +1610,7 @@ def check_new_log():
16101610

16111611
@unittest.skipIf(VALGRIND,
16121612
"Valgrind sometimes fails assert on injected SEGV")
1613-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "temporary, until fedora-34 gets crashlog libs fixed")
1613+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "temporary, until fedora-34 gets crashlog libs fixed")
16141614
def test_crashlog(node_factory):
16151615
l1 = node_factory.get_node(may_fail=True, allow_broken_log=True)
16161616

@@ -1844,7 +1844,7 @@ def mock_fail(*args):
18441844

18451845
@pytest.mark.developer("needs --dev-force-bip32-seed")
18461846
@unittest.skipIf(TEST_NETWORK != 'regtest', "Addresses are network specific")
1847-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support forced secrets")
1847+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support forced secrets")
18481848
def test_dev_force_bip32_seed(node_factory):
18491849
l1 = node_factory.get_node(options={'dev-force-bip32-seed': '0000000000000000000000000000000000000000000000000000000000000001'})
18501850
# First is m/0/0/1 ..
@@ -2175,7 +2175,7 @@ def test_regtest_upgrade(node_factory):
21752175

21762176
@unittest.skipIf(VALGRIND, "valgrind files can't be written since we rmdir")
21772177
@unittest.skipIf(TEST_NETWORK != "regtest", "needs bitcoin mainnet")
2178-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't create hsm_secret file")
2178+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't create hsm_secret file")
21792179
def test_new_node_is_mainnet(node_factory):
21802180
"""Test that an empty directory causes us to be on mainnet"""
21812181
l1 = node_factory.get_node(start=False, may_fail=True)
@@ -2412,7 +2412,7 @@ def test_sendonionmessage_reply(node_factory):
24122412

24132413

24142414
@pytest.mark.developer("needs --dev-force-privkey")
2415-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dev-force-privkey")
2415+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dev-force-privkey")
24162416
def test_getsharedsecret(node_factory):
24172417
"""
24182418
Test getsharedsecret command.

0 commit comments

Comments
 (0)