Commit 76a58971 authored by Benjamin Blanc's avatar Benjamin Blanc

util: testnode upp

parent 6d8c99a2
...@@ -128,6 +128,8 @@ class ScalabilityLauncher(object): ...@@ -128,6 +128,8 @@ class ScalabilityLauncher(object):
else: else:
# Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ? # Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ?
self.log("Test Case %s is running..." %(current_test.title)) self.log("Test Case %s is running..." %(current_test.title))
time.sleep(5)
self.log("Test Case %s is finish" %(current_test.title))
current_test.stop() current_test.stop()
self.log("Test Case Stopped") self.log("Test Case Stopped")
......
...@@ -378,6 +378,18 @@ class TestResultProxy(RPCRetry): ...@@ -378,6 +378,18 @@ class TestResultProxy(RPCRetry):
if self._watcher_thread is not None: if self._watcher_thread is not None:
self._watcher_thread.join() self._watcher_thread.join()
def stop(self):
"""
"""
return self._retryRPC('stopTest', [self._test_result_path])
def fail(self):
"""
"""
return self._retryRPC('failTest', [self._test_result_path])
class TestResultProxyProxy(TestResultProxy): class TestResultProxyProxy(TestResultProxy):
""" """
A wrapper/proxy to TestResultProxy A wrapper/proxy to TestResultProxy
...@@ -416,6 +428,7 @@ class TestResultProxyProxy(TestResultProxy): ...@@ -416,6 +428,7 @@ class TestResultProxyProxy(TestResultProxy):
class ServerProxy(xmlrpclib.ServerProxy): class ServerProxy(xmlrpclib.ServerProxy):
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
......
...@@ -301,41 +301,58 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -301,41 +301,58 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
exclude_list=[x for x in test_list if x!=test_list[count]] exclude_list=[x for x in test_list if x!=test_list[count]]
count += 1 count += 1
test_result_line_proxy = test_result_proxy.start(exclude_list) test_result_line_proxy = test_result_proxy.start(exclude_list)
# Possible ? :
# No more test to run # No more test to run
if test_result_line_proxy == None : if test_result_line_proxy == None :
# Hum normal ?
self.log("Already tested.") self.log("Already tested.")
# Clean up error = ValueError("Test already tested.")
return {'status_code' : 0} break;
self.log("Test for count : %d is in a running state." %count) self.log("Test for count : %d is in a running state." %count)
while test_result_line_proxy.isRunning() and test_result_proxy.isAlive(): while test_result_line_proxy.isRunning() and test_result_proxy.isAlive():
time.sleep(15) time.sleep(15)
pass pass
# Check test case state
if test_result_line_proxy.isCompleted(): if test_result_line_proxy.isCompleted():
self.log("Test completed.") self.log("Test case completed.")
pass error = None
elif not test_result_proxy.isAlive(): elif not test_result_proxy.isAlive():
self.log("Test cancelled.") self.log("Test cancelled.")
# Here do somethig with instances # Here do somethig with instances
raise ValueError("Test cancelled") error = ValueError("Test cancelled")
break;
elif test_result_line_proxy.isFailed(): elif test_result_line_proxy.isFailed():
self.log("Test failed.") self.log("Test failed.")
# Here do somethig with instances # Here do somethig with instances
raise ValueError("Test failed") error = ValueError("Test failed")
break;
elif test_result_line_proxy.isCancelled(): elif test_result_line_proxy.isCancelled():
self.log("Test cancelled.") self.log("Test cancelled.")
# Here do somethig with instances # Here do somethig with instances
raise ValueError("Test has been cancelled") error = ValueError("Test has been cancelled")
break;
elif test_result_line_proxy.isRunning(): elif test_result_line_proxy.isRunning():
self.log("Test always running after max time elapsed.") self.log("Test always running after max time elapsed.")
# Here do somethig with instances # Here do somethig with instances
raise ValueError("Max time for this test case is elapsed.") error = ValueError("Max time for this test case is elapsed.")
break;
else: else:
self.log("Test in a undeterminated state.") self.log("Test in a undeterminated state.")
raise ValueError("Test case is in an undeterminated state") error = ValueError("Test case is in an undeterminated state")
break;
# Here delete intances
if error != None:
test_result_proxy.fail()
raise error
else:
test_result_proxy.stop()
# todo : something like test_result_line_proxy.stop()
return {'status_code' : 0} return {'status_code' : 0}
def _cleanUpNodesInformation(self): def _cleanUpNodesInformation(self):
......
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