functional_tests: reset blockchain on test start

This commit is contained in:
moneromooo-monero 2019-04-19 22:47:44 +00:00
parent 375fde9454
commit aba2b2e7a2
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
8 changed files with 57 additions and 0 deletions

View file

@ -45,9 +45,16 @@ from framework.daemon import Daemon
class BlockchainTest(): class BlockchainTest():
def run_test(self): def run_test(self):
self.reset()
self._test_generateblocks(5) self._test_generateblocks(5)
self._test_alt_chains() self._test_alt_chains()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def _test_generateblocks(self, blocks): def _test_generateblocks(self, blocks):
assert blocks >= 2 assert blocks >= 2

View file

@ -38,10 +38,17 @@ from framework.wallet import Wallet
class ColdSigningTest(): class ColdSigningTest():
def run_test(self): def run_test(self):
self.reset()
self.create(0) self.create(0)
self.mine() self.mine()
self.transfer() self.transfer()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self, idx): def create(self, idx):
print 'Creating hot and cold wallet' print 'Creating hot and cold wallet'

View file

@ -43,9 +43,16 @@ from framework.wallet import Wallet
class MiningTest(): class MiningTest():
def run_test(self): def run_test(self):
self.reset()
self.create() self.create()
self.mine() self.mine()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print 'Creating wallet'
wallet = Wallet() wallet = Wallet()

View file

@ -38,6 +38,7 @@ from framework.wallet import Wallet
class MultisigTest(): class MultisigTest():
def run_test(self): def run_test(self):
self.reset()
self.mine('493DsrfJPqiN3Suv9RcRDoZEbQtKZX1sNcGPA3GhkKYEEmivk8kjQrTdRdVc4ZbmzWJuE157z9NNUKmF2VDfdYDR3CziGMk', 5) self.mine('493DsrfJPqiN3Suv9RcRDoZEbQtKZX1sNcGPA3GhkKYEEmivk8kjQrTdRdVc4ZbmzWJuE157z9NNUKmF2VDfdYDR3CziGMk', 5)
self.mine('42jSRGmmKN96V2j3B8X2DbiNThBXW1tSi1rW1uwkqbyURenq3eC3yosNm8HEMdHuWwKMFGzMUB3RCTvcTaW9kHpdRPP7p5y', 5) self.mine('42jSRGmmKN96V2j3B8X2DbiNThBXW1tSi1rW1uwkqbyURenq3eC3yosNm8HEMdHuWwKMFGzMUB3RCTvcTaW9kHpdRPP7p5y', 5)
self.mine('47fF32AdrmXG84FcPY697uZdd42pMMGiH5UpiTRTt3YX2pZC7t7wkzEMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUgxRd53', 5) self.mine('47fF32AdrmXG84FcPY697uZdd42pMMGiH5UpiTRTt3YX2pZC7t7wkzEMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUgxRd53', 5)
@ -68,6 +69,12 @@ class MultisigTest():
self.import_multisig_info([0, 1, 2, 3], 6) self.import_multisig_info([0, 1, 2, 3], 6)
self.check_transaction(txid) self.check_transaction(txid)
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def mine(self, address, blocks): def mine(self, address, blocks):
print("Mining some blocks") print("Mining some blocks")
daemon = Daemon() daemon = Daemon()

View file

@ -38,6 +38,7 @@ from framework.wallet import Wallet
class ProofsTest(): class ProofsTest():
def run_test(self): def run_test(self):
self.reset()
self.mine('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80) self.mine('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80)
self.create_wallets() self.create_wallets()
txid, tx_key, amount = self.transfer() txid, tx_key, amount = self.transfer()
@ -45,6 +46,12 @@ class ProofsTest():
self.check_tx_proof(txid, amount) self.check_tx_proof(txid, amount)
self.check_reserve_proof() self.check_reserve_proof()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def mine(self, address, blocks): def mine(self, address, blocks):
print("Mining some blocks") print("Mining some blocks")
daemon = Daemon() daemon = Daemon()

View file

@ -39,6 +39,7 @@ from framework.wallet import Wallet
class TransferTest(): class TransferTest():
def run_test(self): def run_test(self):
self.reset()
self.create() self.create()
self.mine() self.mine()
self.transfer() self.transfer()
@ -46,6 +47,12 @@ class TransferTest():
self.check_double_spend_detection() self.check_double_spend_detection()
self.sweep_single() self.sweep_single()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallets' print 'Creating wallets'
seeds = [ seeds = [

View file

@ -38,10 +38,17 @@ from framework.wallet import Wallet
class TransferTest(): class TransferTest():
def run_test(self): def run_test(self):
self.reset()
self.create() self.create()
self.mine() self.mine()
self.check_txpool() self.check_txpool()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print 'Creating wallet'
wallet = Wallet() wallet = Wallet()

View file

@ -39,9 +39,11 @@ Test the following RPCs:
""" """
from framework.wallet import Wallet from framework.wallet import Wallet
from framework.daemon import Daemon
class WalletAddressTest(): class WalletAddressTest():
def run_test(self): def run_test(self):
self.reset()
self.create() self.create()
self.check_main_address() self.check_main_address()
self.check_keys() self.check_keys()
@ -49,6 +51,12 @@ class WalletAddressTest():
self.open_close() self.open_close()
self.languages() self.languages()
def reset(self):
print 'Resetting blockchain'
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print 'Creating wallet'
wallet = Wallet() wallet = Wallet()