resiliencytest: adapt abstract test suite to work with a single clone.

parent 245932ae
...@@ -34,6 +34,8 @@ import slapos.slap ...@@ -34,6 +34,8 @@ import slapos.slap
import logging import logging
import time import time
import os import os
import subprocess
import sys
UNIT_TEST_ERP5TESTNODE = 'UnitTest' UNIT_TEST_ERP5TESTNODE = 'UnitTest'
...@@ -59,7 +61,7 @@ class ResiliencyTestSuite(object): ...@@ -59,7 +61,7 @@ class ResiliencyTestSuite(object):
self.total_instance_count = total_instance_count self.total_instance_count = total_instance_count
self.root_instance_name = root_instance_name self.root_instance_name = root_instance_name
self.sleep_time_between_test = sleep_time_between_test self.sleep_time_between_test = sleep_time_between_test
self.suite_type = type self.test_type = type
slap = slapos.slap.slap() slap = slapos.slap.slap()
slap.initializeConnection(server_url, key_file, cert_file) slap.initializeConnection(server_url, key_file, cert_file)
...@@ -161,7 +163,7 @@ class ResiliencyTestSuite(object): ...@@ -161,7 +163,7 @@ class ResiliencyTestSuite(object):
self.logger.info( self.logger.info(
'Sleeping for %s seconds before testing clone %s.' % ( 'Sleeping for %s seconds before testing clone %s.' % (
self.sleep_time_between_test, self.sleep_time_between_test,
current_clone clone
)) ))
time.sleep(self.sleep_time_between_test) time.sleep(self.sleep_time_between_test)
...@@ -179,7 +181,6 @@ class ResiliencyTestSuite(object): ...@@ -179,7 +181,6 @@ class ResiliencyTestSuite(object):
subprocess.Popen(command).wait() subprocess.Popen(command).wait()
subprocess.Popen(command).wait() subprocess.Popen(command).wait()
subprocess.Popen(command).wait() subprocess.Popen(command).wait()
new_ip = ip
success = self.checkDataOnCloneInstance() success = self.checkDataOnCloneInstance()
if success: if success:
...@@ -203,11 +204,20 @@ class ResiliencyTestSuite(object): ...@@ -203,11 +204,20 @@ class ResiliencyTestSuite(object):
# So first clone starts from 1. # So first clone starts from 1.
current_clone = 1 current_clone = 1
# In case we have only one clone: test the takeover twice
# so that we test the reconstruction of a new clone.
if clone_count == 1:
for i in range(2):
success = self._testClone(1)
if not success:
return False
else:
# Test each clone # Test each clone
while current_clone <= clone_count: while current_clone <= clone_count:
success = self._test_clone(current_clone) success = self._test_clone(current_clone)
if not success: if not success:
return Fasle return False
current_clone = current_clone + 1 current_clone = current_clone + 1
# All clones have been successfully tested: success. # All clones have been successfully tested: success.
......
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