Commit ab552d87 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Julien Muchembled

tests/threaded: Add handy shortcuts to NEOCluster to concisely check cluster properties in tests

parent d9dd39f0
...@@ -668,10 +668,20 @@ class NEOCluster(object): ...@@ -668,10 +668,20 @@ class NEOCluster(object):
return admin return admin
### ###
# More handy shortcuts for tests
@property
def backup_tid(self):
return self.neoctl.getRecovery()[1]
@property
def last_tid(self):
return self.primary_master.getLastTransaction()
@property @property
def primary_master(self): def primary_master(self):
master, = [master for master in self.master_list if master.primary] master, = [master for master in self.master_list if master.primary]
return master return master
###
def reset(self, clear_database=False): def reset(self, clear_database=False):
for node_type in 'master', 'storage', 'admin': for node_type in 'master', 'storage', 'admin':
......
...@@ -142,7 +142,7 @@ class ReplicationTests(NEOThreadedTest): ...@@ -142,7 +142,7 @@ class ReplicationTests(NEOThreadedTest):
self.tic() self.tic()
self.tic() self.tic()
self.assertEqual(np*nr, self.checkBackup(backup, self.assertEqual(np*nr, self.checkBackup(backup,
max_tid=backup.master.getLastTransaction())) max_tid=backup.last_tid))
finally: finally:
backup.stop() backup.stop()
backup.reset() backup.reset()
...@@ -160,7 +160,7 @@ class ReplicationTests(NEOThreadedTest): ...@@ -160,7 +160,7 @@ class ReplicationTests(NEOThreadedTest):
self.tic() self.tic()
self.tic() self.tic()
self.assertEqual(np*nr, self.checkBackup(backup, self.assertEqual(np*nr, self.checkBackup(backup,
max_tid=backup.master.getLastTransaction())) max_tid=backup.last_tid))
finally: finally:
backup.stop() backup.stop()
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment