Soft interrupt tests
This commit is contained in:
parent
ce945ae56e
commit
61d7ee49f3
@ -84,7 +84,7 @@ class TestFilter(unittest.TestCase):
|
|||||||
self.assertEqual(len(fltr_one.contents), 3)
|
self.assertEqual(len(fltr_one.contents), 3)
|
||||||
|
|
||||||
|
|
||||||
def test_driver_interrupt(self):
|
def test_driver_interrupt_noresume(self):
|
||||||
drv = MockDriver(self.store, target=1)
|
drv = MockDriver(self.store, target=1)
|
||||||
|
|
||||||
tx_hash = os.urandom(32).hex()
|
tx_hash = os.urandom(32).hex()
|
||||||
@ -102,7 +102,7 @@ class TestFilter(unittest.TestCase):
|
|||||||
|
|
||||||
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
|
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
|
||||||
|
|
||||||
fltr_one = MockFilter('foo', brk_hard=1)
|
fltr_one = MockFilter('foo') #, brk_hard=1)
|
||||||
store.register(fltr_one)
|
store.register(fltr_one)
|
||||||
fltr_two = MockFilter('bar')
|
fltr_two = MockFilter('bar')
|
||||||
store.register(fltr_two)
|
store.register(fltr_two)
|
||||||
@ -122,5 +122,30 @@ class TestFilter(unittest.TestCase):
|
|||||||
# drv.run(self.conn)
|
# drv.run(self.conn)
|
||||||
|
|
||||||
|
|
||||||
|
def test_driver_interrupt_resume(self):
|
||||||
|
drv = MockDriver(self.store, target=1)
|
||||||
|
|
||||||
|
tx_hash = os.urandom(32).hex()
|
||||||
|
tx = MockTx(0, tx_hash)
|
||||||
|
block = MockBlock(0, [tx_hash])
|
||||||
|
drv.add_block(block)
|
||||||
|
|
||||||
|
tx_hash = os.urandom(32).hex()
|
||||||
|
tx = MockTx(0, tx_hash)
|
||||||
|
block = MockBlock(1, [tx_hash])
|
||||||
|
drv.add_block(block)
|
||||||
|
|
||||||
|
fltr_one = MockFilter('foo', brk=1)
|
||||||
|
self.store.register(fltr_one)
|
||||||
|
fltr_two = MockFilter('bar')
|
||||||
|
self.store.register(fltr_two)
|
||||||
|
|
||||||
|
|
||||||
|
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
|
||||||
|
|
||||||
|
with self.assertRaises(SyncDone):
|
||||||
|
drv.run(self.conn)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user