Browse Source

chore: reduce CI load merging a testcase

ppa-prep
Michael Schmoock 5 years ago
committed by neil saitug
parent
commit
183f7698c3
  1. 21
      tests/test_connection.py
  2. 11
      tests/test_plugin.py

21
tests/test_connection.py

@ -2744,27 +2744,6 @@ def test_htlc_retransmit_order(node_factory, executor):
# If order was wrong, we'll get a LOG_BROKEN and fixtures will complain. # If order was wrong, we'll get a LOG_BROKEN and fixtures will complain.
def test_channel_opener(node_factory):
""" Simply checks for 'opener' and 'closer' attributes on `listpeers` channels """
l1, l2 = node_factory.line_graph(2)
assert(l1.rpc.listpeers()['peers'][0]['channels'][0]['opener'] == 'local')
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['opener'] == 'remote')
# 'closer' should be null initially
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] is None)
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] is None)
# close and check for 'closer'
l1.rpc.close(l2.rpc.getinfo()["id"])
l1.daemon.wait_for_log("State changed from CHANNELD_NORMAL to")
l2.daemon.wait_for_log("State changed from CHANNELD_NORMAL to")
# 'closer' should now be set accordingly
assert(l1.rpc.listpeers()['peers'][0]['channels'][0]['closer'] == 'local')
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] == 'remote')
def test_fundchannel_start_alternate(node_factory, executor): def test_fundchannel_start_alternate(node_factory, executor):
''' Test to see what happens if two nodes start channeling to ''' Test to see what happens if two nodes start channeling to
each other alternately. each other alternately.

11
tests/test_plugin.py

@ -643,6 +643,13 @@ def test_channel_state_changed_bilateral(node_factory, bitcoind):
event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0]) event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0])
return event return event
# check channel 'opener' and 'closer' within this testcase ...
assert(l1.rpc.listpeers()['peers'][0]['channels'][0]['opener'] == 'local')
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['opener'] == 'remote')
# the 'closer' should be null initially
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] is None)
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] is None)
event1 = wait_for_event(l1) event1 = wait_for_event(l1)
assert(event1['peer_id'] == l2_id) # we only test these IDs the first time assert(event1['peer_id'] == l2_id) # we only test these IDs the first time
assert(event1['channel_id'] == cid) assert(event1['channel_id'] == cid)
@ -678,6 +685,10 @@ def test_channel_state_changed_bilateral(node_factory, bitcoind):
assert(event2['cause'] == "remote") assert(event2['cause'] == "remote")
assert(event2['message'] == "Peer closes channel") assert(event2['message'] == "Peer closes channel")
# 'closer' should now be set accordingly ...
assert(l1.rpc.listpeers()['peers'][0]['channels'][0]['closer'] == 'local')
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] == 'remote')
event1 = wait_for_event(l1) event1 = wait_for_event(l1)
assert(event1['old_state'] == "CHANNELD_SHUTTING_DOWN") assert(event1['old_state'] == "CHANNELD_SHUTTING_DOWN")
assert(event1['new_state'] == "CLOSINGD_SIGEXCHANGE") assert(event1['new_state'] == "CLOSINGD_SIGEXCHANGE")

Loading…
Cancel
Save