mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-22 19:49:20 +00:00
tests: Ensure XMR new subaddress is unique.
Fix xmr test 9.1 wait for event type. Fix node shutdown issue.
This commit is contained in:
parent
ebcd7738e5
commit
db0e85d37c
3 changed files with 19 additions and 5 deletions
|
@ -373,6 +373,7 @@ class BasicSwap(BaseApp):
|
||||||
|
|
||||||
with self.mxDB:
|
with self.mxDB:
|
||||||
self.delay_event.set()
|
self.delay_event.set()
|
||||||
|
self.chainstate_delay_event.set()
|
||||||
|
|
||||||
if self._network:
|
if self._network:
|
||||||
self._network.stopNetwork()
|
self._network.stopNetwork()
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
- Temporarily disabled Navcoin.
|
- Temporarily disabled Navcoin.
|
||||||
- Untested on mainnet.
|
- Untested on mainnet.
|
||||||
|
- Fixed bug where requesting a new XMR subaddress would return an old one.
|
||||||
|
|
||||||
|
|
||||||
0.0.67
|
0.0.67
|
||||||
|
|
|
@ -604,14 +604,15 @@ class BaseTest(unittest.TestCase):
|
||||||
cls.coins_update_thread.join()
|
cls.coins_update_thread.join()
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.info('Failed to join coins_update_thread')
|
logging.info('Failed to join coins_update_thread')
|
||||||
|
|
||||||
for t in cls.http_threads:
|
for t in cls.http_threads:
|
||||||
t.stop()
|
t.stop()
|
||||||
t.join()
|
t.join()
|
||||||
|
logging.info('Stopping swap clients')
|
||||||
for c in cls.swap_clients:
|
for c in cls.swap_clients:
|
||||||
c.finalise()
|
c.finalise()
|
||||||
c.fp.close()
|
c.fp.close()
|
||||||
|
|
||||||
|
logging.info('Stopping coin nodes')
|
||||||
stopDaemons(cls.xmr_daemons)
|
stopDaemons(cls.xmr_daemons)
|
||||||
stopDaemons(cls.part_daemons)
|
stopDaemons(cls.part_daemons)
|
||||||
stopDaemons(cls.btc_daemons)
|
stopDaemons(cls.btc_daemons)
|
||||||
|
@ -1069,7 +1070,7 @@ class Test(BaseTest):
|
||||||
js_w0_before = read_json_api(1800, 'wallets')
|
js_w0_before = read_json_api(1800, 'wallets')
|
||||||
js_w1_before = read_json_api(1801, 'wallets')
|
js_w1_before = read_json_api(1801, 'wallets')
|
||||||
|
|
||||||
amt_1 = make_int(random.uniform(0.001, 49.0), scale=8, r=1)
|
amt_1 = make_int(random.uniform(0.001, 19.0), scale=8, r=1)
|
||||||
amt_2 = make_int(random.uniform(0.001, 49.0), scale=8, r=1)
|
amt_2 = make_int(random.uniform(0.001, 49.0), scale=8, r=1)
|
||||||
|
|
||||||
rate_1 = make_int(random.uniform(80.0, 110.0), scale=12, r=1)
|
rate_1 = make_int(random.uniform(80.0, 110.0), scale=12, r=1)
|
||||||
|
@ -1207,11 +1208,12 @@ class Test(BaseTest):
|
||||||
# Should fail > max concurrent
|
# Should fail > max concurrent
|
||||||
test_delay_event.wait(1.0)
|
test_delay_event.wait(1.0)
|
||||||
bid_id = swap_clients[1].postBid(offer_id, min_bid)
|
bid_id = swap_clients[1].postBid(offer_id, min_bid)
|
||||||
event = wait_for_event(test_delay_event, swap_clients[0], Concepts.AUTOMATION, bid_id)
|
logging.info('Waiting for bid {} to fail.'.format(bid_id.hex()))
|
||||||
|
event = wait_for_event(test_delay_event, swap_clients[0], Concepts.BID, bid_id, event_type=EventLogTypes.AUTOMATION_CONSTRAINT)
|
||||||
assert ('Already have 5 bids to complete' in event.event_msg)
|
assert ('Already have 5 bids to complete' in event.event_msg)
|
||||||
|
|
||||||
for bid_id in bid_ids:
|
for bid_id in bid_ids:
|
||||||
wait_for_bid(test_delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=180)
|
wait_for_bid(test_delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=240)
|
||||||
wait_for_bid(test_delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, sent=True)
|
wait_for_bid(test_delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, sent=True)
|
||||||
|
|
||||||
amt_bid = make_int(5, scale=8, r=1)
|
amt_bid = make_int(5, scale=8, r=1)
|
||||||
|
@ -1219,7 +1221,7 @@ class Test(BaseTest):
|
||||||
# Should fail > total value
|
# Should fail > total value
|
||||||
amt_bid += 1
|
amt_bid += 1
|
||||||
bid_id = swap_clients[1].postBid(offer_id, amt_bid)
|
bid_id = swap_clients[1].postBid(offer_id, amt_bid)
|
||||||
event = wait_for_event(test_delay_event, swap_clients[0], Concepts.AUTOMATION, bid_id)
|
event = wait_for_event(test_delay_event, swap_clients[0], Concepts.BID, bid_id, event_type=EventLogTypes.AUTOMATION_CONSTRAINT)
|
||||||
assert ('Over remaining offer value' in event.event_msg)
|
assert ('Over remaining offer value' in event.event_msg)
|
||||||
|
|
||||||
# Should pass
|
# Should pass
|
||||||
|
@ -1526,6 +1528,16 @@ class Test(BaseTest):
|
||||||
wait_for_bid(test_delay_event, swap_clients[0], bid_id, BidStates.XMR_SWAP_FAILED_REFUNDED, wait_for=1800)
|
wait_for_bid(test_delay_event, swap_clients[0], bid_id, BidStates.XMR_SWAP_FAILED_REFUNDED, wait_for=1800)
|
||||||
wait_for_bid(test_delay_event, swap_clients[1], bid_id, BidStates.XMR_SWAP_FAILED_REFUNDED, wait_for=1800, sent=True)
|
wait_for_bid(test_delay_event, swap_clients[1], bid_id, BidStates.XMR_SWAP_FAILED_REFUNDED, wait_for=1800, sent=True)
|
||||||
|
|
||||||
|
def test_16_new_subaddress(self):
|
||||||
|
logging.info('---------- Test that new subaddresses are created')
|
||||||
|
|
||||||
|
current_subaddress = read_json_api(1800, 'wallets/xmr')['deposit_address']
|
||||||
|
first_subaddress = read_json_api(1800, 'wallets/xmr/nextdepositaddr')
|
||||||
|
second_subaddress = read_json_api(1800, 'wallets/xmr/nextdepositaddr')
|
||||||
|
assert (first_subaddress != second_subaddress)
|
||||||
|
assert (first_subaddress != current_subaddress)
|
||||||
|
assert (second_subaddress != current_subaddress)
|
||||||
|
|
||||||
def test_97_withdraw_all(self):
|
def test_97_withdraw_all(self):
|
||||||
logging.info('---------- Test XMR withdrawal all')
|
logging.info('---------- Test XMR withdrawal all')
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue