Commit 3e95c2cf authored by Benjamin Blanc's avatar Benjamin Blanc

Up

parent b7680353
...@@ -42,7 +42,8 @@ from ProcessManager import SubprocessError, ProcessManager, CancellationError ...@@ -42,7 +42,8 @@ from ProcessManager import SubprocessError, ProcessManager, CancellationError
from subprocess import CalledProcessError from subprocess import CalledProcessError
from Updater import Updater from Updater import Updater
from erp5.util import taskdistribution from erp5.util import taskdistribution
# for dummy slapos answer
import signal
class ScalabilityTestRunner(): class ScalabilityTestRunner():
...@@ -63,6 +64,9 @@ class ScalabilityTestRunner(): ...@@ -63,6 +64,9 @@ class ScalabilityTestRunner():
# Protection to prevent installation of softwares after checking # Protection to prevent installation of softwares after checking
self.authorize_supply = True self.authorize_supply = True
# Used to simulate SlapOS answer
self.last_slapos_answer = []
def _prepareSlapOS(self, software_path, computer_guid, create_partition=0): def _prepareSlapOS(self, software_path, computer_guid, create_partition=0):
# create_partition is kept for compatibility # create_partition is kept for compatibility
""" """
...@@ -91,15 +95,27 @@ class ScalabilityTestRunner(): ...@@ -91,15 +95,27 @@ class ScalabilityTestRunner():
# software_path_list.append(self.testnode.config.get("software_list")) # software_path_list.append(self.testnode.config.get("software_list"))
return {'status_code' : 0} return {'status_code' : 0}
# For dummy slapos answer
# Press ctrl+c to simulate an (positive) answer from sapos master
def _getSignal(self, signal, frame):
self.last_slapos_answer.append(True)
def _prepareDummySlapOSAnswer(self):
signal.signal(signal.SIGINT, self._getSignal)
def simulateSlapOSAnswer(self):
if len(self.last_slapos_answer)==0:
return False
else:
return self.last_slapos_answer.pop()
# /For dummy slapos answer
def isSoftwareReleaseReady(self, software_url, computer_guid): def isSoftwareReleaseReady(self, software_url, computer_guid):
""" """
Return true if the specified software on the specified node is installed. Return true if the specified software on the specified node is installed.
This method should communicates with SlapOS Master. This method should communicates with SlapOS Master.
""" """
# TODO : implement this method # TODO : implement -> communication with SlapOS master
# -> communication with SlapOS master # this simulate a SlapOS answer
# todo : simulate slapOS Master answer return self.simulateSlapOSAnswer()
return False
def remainSoftwareToInstall(self): def remainSoftwareToInstall(self):
""" """
...@@ -153,6 +169,8 @@ class ScalabilityTestRunner(): ...@@ -153,6 +169,8 @@ class ScalabilityTestRunner():
self._prepareSlapOS(software_path, computer_guid) self._prepareSlapOS(software_path, computer_guid)
# From the line below we would not supply any more softwares # From the line below we would not supply any more softwares
self.authorize_supply = False self.authorize_supply = False
_prepareDummySlapOSAnswer()
# Waiting until all softwares are installed # Waiting until all softwares are installed
while ( self.remainSoftwareToInstall() while ( self.remainSoftwareToInstall()
and (max_time > (time.time()-start_time))): and (max_time > (time.time()-start_time))):
......
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