Skip to content

Commit e3bbc83

Browse files
devrandomksedgwic
authored andcommitted
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 3960bac commit e3bbc83

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
@@ -1082,7 +1082,7 @@ def test_channel_lease_lessee_cheat(node_factory, bitcoind, chainparams):
10821082

10831083
@pytest.mark.developer("needs DEVELOPER=1")
10841084
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db")
1085-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't sign revoked commitment number")
1085+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't sign revoked commitment number")
10861086
@pytest.mark.slow_test
10871087
def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
10881088
""" Test that the penalizing node claims any published
@@ -1216,7 +1216,7 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
12161216

12171217
@pytest.mark.developer("needs DEVELOPER=1")
12181218
@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Makes use of the sqlite3 db")
1219-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "policy: can't sign revoked commitment number")
1219+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "policy: can't sign revoked commitment number")
12201220
@pytest.mark.slow_test
12211221
def test_penalty_htlc_tx_timeout(node_factory, bitcoind, chainparams):
12221222
""" Test that the penalizing node claims any published
@@ -2812,7 +2812,7 @@ def test_permfail_htlc_out(node_factory, bitcoind, executor):
28122812

28132813

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

@@ -2917,7 +2917,7 @@ def test_shutdown(node_factory):
29172917

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

30763076

3077-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remotesigner won't sign close w/ wrong txid")
3077+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remotesigner won't sign close w/ wrong txid")
30783078
@pytest.mark.openchannel('v1')
30793079
def test_shutdown_alternate_txid(node_factory, bitcoind):
30803080
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
@@ -489,7 +489,7 @@ def is_p2wpkh(output):
489489
assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
490490

491491

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

10761076

1077-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd integration test job control fails here")
1077+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd integration test job control fails here")
10781078
def test_daemon_option(node_factory):
10791079
"""
10801080
Make sure --daemon at least vaguely works!
@@ -1109,7 +1109,7 @@ def test_daemon_option(node_factory):
11091109

11101110
@flaky
11111111
@pytest.mark.developer("needs DEVELOPER=1")
1112-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't have repeatable random seeding")
1112+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't have repeatable random seeding")
11131113
def test_blockchaintrack(node_factory, bitcoind):
11141114
"""Check that we track the blockchain correctly across reorgs
11151115
"""
@@ -1553,7 +1553,7 @@ def check_new_log():
15531553

15541554
@unittest.skipIf(VALGRIND,
15551555
"Valgrind sometimes fails assert on injected SEGV")
1556-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "temporary, until fedora-34 gets crashlog libs fixed")
1556+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "temporary, until fedora-34 gets crashlog libs fixed")
15571557
def test_crashlog(node_factory):
15581558
l1 = node_factory.get_node(may_fail=True, allow_broken_log=True)
15591559

@@ -1787,7 +1787,7 @@ def mock_fail(*args):
17871787

17881788
@pytest.mark.developer("needs --dev-force-bip32-seed")
17891789
@unittest.skipIf(TEST_NETWORK != 'regtest', "Addresses are network specific")
1790-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support forced secrets")
1790+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support forced secrets")
17911791
def test_dev_force_bip32_seed(node_factory):
17921792
l1 = node_factory.get_node(options={'dev-force-bip32-seed': '0000000000000000000000000000000000000000000000000000000000000001'})
17931793
# First is m/0/0/1 ..
@@ -2120,7 +2120,7 @@ def test_regtest_upgrade(node_factory):
21202120

21212121
@unittest.skipIf(VALGRIND, "valgrind files can't be written since we rmdir")
21222122
@unittest.skipIf(TEST_NETWORK != "regtest", "needs bitcoin mainnet")
2123-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't create hsm_secret file")
2123+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't create hsm_secret file")
21242124
def test_new_node_is_mainnet(node_factory):
21252125
"""Test that an empty directory causes us to be on mainnet"""
21262126
l1 = node_factory.get_node(start=False, may_fail=True)
@@ -2357,7 +2357,7 @@ def test_sendobsonionmessage_reply(node_factory):
23572357

23582358

23592359
@pytest.mark.developer("needs --dev-force-privkey")
2360-
@unittest.skipIf(os.getenv('SUBDAEMON') == 'hsmd:remote_hsmd', "remote_hsmd doesn't support dev-force-privkey")
2360+
@unittest.skipIf(os.getenv('SUBDAEMON').startswith('hsmd:remote_hsmd'), "remote_hsmd doesn't support dev-force-privkey")
23612361
def test_getsharedsecret(node_factory):
23622362
"""
23632363
Test getsharedsecret command.

0 commit comments

Comments
 (0)