Commit 933a0121 authored by Grégory Wisniewski's avatar Grégory Wisniewski

- Add a stop() method on NeoProcess.

- Add expectCluster<State>() on NeoCluster
- expectNoOutdatedCells renamed as expectOutdatedCells to expect a given number
a cell in OUT_OF_DATE state.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1214 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1f97271a
...@@ -134,6 +134,10 @@ class NEOProcess: ...@@ -134,6 +134,10 @@ class NEOProcess:
self.pid = 0 self.pid = 0
return result return result
def stop(self):
self.kill()
self.wait()
def getUUID(self): def getUUID(self):
return self.uuid return self.uuid
...@@ -419,14 +423,15 @@ class NEOCluster(object): ...@@ -419,14 +423,15 @@ class NEOCluster(object):
return uuid is None or uuid == current_try, current_try return uuid is None or uuid == current_try, current_try
self.expectCondition(callback, timeout, delay) self.expectCondition(callback, timeout, delay)
def expectNoOudatedCells(self, timeout=0, delay=1): def expectOudatedCells(self, number, timeout=0, delay=1):
def callback(last_try): def callback(last_try):
row_list = self.neoctl.getPartitionRowList()[1] row_list = self.neoctl.getPartitionRowList()[1]
number_of_oudated = 0
for row in row_list: for row in row_list:
for cell in row[1]: for cell in row[1]:
if cell[1] != protocol.UP_TO_DATE_STATE: if cell[1] == protocol.OUT_OF_DATE_STATE:
return False, last_try number_of_oudated += 1
return True, last_try return number_of_oudated == number, number_of_oudated
self.expectCondition(callback, timeout, delay) self.expectCondition(callback, timeout, delay)
def expectClusterState(self, state, timeout=0, delay=1): def expectClusterState(self, state, timeout=0, delay=1):
...@@ -435,6 +440,15 @@ class NEOCluster(object): ...@@ -435,6 +440,15 @@ class NEOCluster(object):
return current_try == state, current_try return current_try == state, current_try
self.expectCondition(callback, timeout, delay) self.expectCondition(callback, timeout, delay)
def expectClusterRecovering(self, timeout=0, delay=1):
self.expectClusterState(protocol.RECOVERING)
def expectClusterVeryfing(self, timeout=0, delay=1):
self.expectClusterState(protocol.VERIFYING)
def expectClusterRunning(self, timeout=0, delay=1):
self.expectClusterState(protocol.RUNNING)
def __del__(self): def __del__(self):
if self.cleanup_on_delete: if self.cleanup_on_delete:
os.removedirs(self.temp_dir) os.removedirs(self.temp_dir)
......
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