Commit 5c0f49d1 authored by Benjamin Blanc's avatar Benjamin Blanc

fixup! testnode: ScalabilityTestRunner: Use SlapOSMasterCommunicator

parent 9cbd5218
...@@ -173,15 +173,12 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -173,15 +173,12 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# this simulate a SlapOS answer # this simulate a SlapOS answer
return self.simulateSlapOSAnswer() return self.simulateSlapOSAnswer()
def isInstanceReady(self, instance_title): def isInstanceReady(self, instance_title, state):
""" """
Return true if the specified instance is ready. Return true if the specified instance is ready.
This method should communicates with SlapOS Master. This method should communicates with SlapOS Master.
""" """
# TODO : implement -> communication with SlapOS master return self.slapos_communicator.isInstanceCorrectly(instance_title, state)
# this simulate a SlapOS answer
#return self.simulateSlapOSAnswer()
return self.slapos_communicator.isInstanceCorrectly(instance_title, 'started')
def remainSoftwareToInstall(self): def remainSoftwareToInstall(self):
""" """
...@@ -207,15 +204,11 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -207,15 +204,11 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
return {'status_code' : 0} return {'status_code' : 0}
# Used to simulate slapOS answer # Used to simulate slapOS answer
def _waitInstance(self, instance_title): def _waitInstance(self, instance_title, state):
self.log("Master testnode is waiting for a (dummy) SlapOS Master answer,\ self.log("Wait for instance state: %s" %state)
(kill -10 %s) to continue...", str(os.getpid())) while (not self.isInstanceReady(instance_title, state)):
self._prepareDummySlapOSAnswer() time.sleep(15)
while (not self.isInstanceReady(instance_title)):
time.sleep(5)
pass pass
self._comeBackFromDummySlapOS()
self.log("Answer received.")
def prepareSlapOSForTestSuite(self, node_test_suite): def prepareSlapOSForTestSuite(self, node_test_suite):
""" """
...@@ -303,8 +296,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -303,8 +296,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self._createInstance(self.reachable_profile, configuration_list[0], self._createInstance(self.reachable_profile, configuration_list[0],
self.instance_title, node_test_suite.test_result, node_test_suite.test_suite) self.instance_title, node_test_suite.test_result, node_test_suite.test_suite)
self.log("Waiting for instance creation..") self.log("Waiting for instance creation..")
#self._waitInstance(self.instance_title) self._waitInstance(self.instance_title, 'started')
self.slapos_communicator.isInstanceCorrectly(self.self.instance_title, 'started')
self.log("Scalability instance requested") self.log("Scalability instance requested")
""" except: """ except:
self.log("Unable to launch instance") self.log("Unable to launch instance")
...@@ -332,22 +324,16 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -332,22 +324,16 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# Stop instance # Stop instance
self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title)) self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title))
self.slapos_controler.stopInstance(self.instance_title) self.slapos_controler.stopInstance(self.instance_title)
self.log("Waiting for instance stop..") self._waitInstance(self.instance_title, 'stopped')
#self._waitInstance(self.instance_title)
self.slapos_communicator.isInstanceCorrectly(self.instance_title, 'stopped')
# Update instance XML configuration # Update instance XML configuration
self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title)) self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title))
self._updateInstanceXML(configuration, self.instance_title, self._updateInstanceXML(configuration, self.instance_title,
node_test_suite.test_result, node_test_suite.test_suite) node_test_suite.test_result, node_test_suite.test_suite)
self.log("Waiting for XML updating instance ready..") self._waitInstance(self.instance_title, 'started')
#self._waitInstance(self.instance_title)
self.slapos_communicator.isInstanceCorrectly(self.instance_title, 'started')
# Start instance # Start instance
self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title)) self.log("Instance state: %s", self.slapos_controler.getInstanceState(self.instance_title))
self.slapos_controler.startInstance(self.instance_title) self.slapos_controler.startInstance(self.instance_title)
self.log("Waiting for instance start..") self._waitInstance(self.instance_title, 'started')
self.slapos_communicator.isInstanceCorrectly(self.instance_title, 'started')
#self._waitInstance(self.instance_title)
# Start only the current test # Start only the current test
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]]
......
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