Commit b17843bc authored by Jérome Perrin's avatar Jérome Perrin

resiliencytestsuite,kvm: more python3 fixes

parent ec47c8e3
Pipeline #23107 passed with stage
in 0 seconds
...@@ -45,7 +45,7 @@ def fetchKey(ip): ...@@ -45,7 +45,7 @@ def fetchKey(ip):
new_key = None new_key = None
for i in range(0, 10): for i in range(0, 10):
try: try:
new_key = urlopen('http://%s:10080/get' % ip).read().strip() new_key = urlopen('http://%s:10080/get' % ip).read().strip().decode()
break break
except IOError: except IOError:
logger.error('Server in new KVM does not answer.') logger.error('Server in new KVM does not answer.')
...@@ -138,7 +138,7 @@ class KVMTestSuite(ResiliencyTestSuite): ...@@ -138,7 +138,7 @@ class KVMTestSuite(ResiliencyTestSuite):
Set a random key that will be stored inside of the virtual hard drive. Set a random key that will be stored inside of the virtual hard drive.
""" """
self.key = ''.join(random.SystemRandom().sample(string.ascii_lowercase, 20)) self.key = ''.join(random.SystemRandom().sample(string.ascii_lowercase, 20))
self.logger.info('Generated key is: %s' % self.key) self.logger.info('Generated key is: %s', self.key)
def pushDataOnMainInstance(self): def pushDataOnMainInstance(self):
self.logger.info('Getting the KVM IP...') self.logger.info('Getting the KVM IP...')
...@@ -171,7 +171,7 @@ class KVMTestSuite(ResiliencyTestSuite): ...@@ -171,7 +171,7 @@ class KVMTestSuite(ResiliencyTestSuite):
) )
new_key = fetchKey(self.ip) new_key = fetchKey(self.ip)
logger.info('Key on this new instance is %s' % new_key) logger.info('Key on this new instance is %s', new_key)
# Compare with original key. If same: success. # Compare with original key. If same: success.
if new_key == self.key: if new_key == self.key:
......
...@@ -86,7 +86,7 @@ class ResiliencyTestSuite(object): ...@@ -86,7 +86,7 @@ class ResiliencyTestSuite(object):
# Do takeover # Do takeover
takeover_result = urlopen('%s?password=%s' % (takeover_url, takeover_password)).read() takeover_result = urlopen('%s?password=%s' % (takeover_url, takeover_password)).read()
if 'Error' in takeover_result: if b'Error' in takeover_result:
raise Exception('Error while doing takeover: %s' % takeover_result) raise Exception('Error while doing takeover: %s' % takeover_result)
self.logger.info('Done.') self.logger.info('Done.')
......
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