From 6d7b2bc0f1a62c786dab4f0ea3e61609de5988eb Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 11 Sep 2015 15:43:58 +0000 Subject: Improve test command running, and other review comments from Richard Maw. --- openstack/tester | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/openstack/tester b/openstack/tester index 5d8ed41..adc260e 100755 --- a/openstack/tester +++ b/openstack/tester @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2014 Codethink Ltd +# Copyright 2015 Codethink Ltd # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,17 +15,15 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -'''release-test +'''openstack/tester -This script deploys the set of systems in the cluster morphology it is -instructed to read, to test that they work correctly. +This script tests an image on openstack. ''' import cliapp import os import pipes -import shlex import shutil import socket import tempfile @@ -191,7 +189,7 @@ class Deployment(object): time.sleep(20) # Assign a floating IP address - for retries in range(5, 0, -1): + for _ in xrange(5): ip_list = nc.floating_ips.list() free_ip = None for ip in ip_list: @@ -238,7 +236,7 @@ class ReleaseApp(cliapp.Application): for test in tests: with open(test, 'r') as stream: - data=yaml.load(stream) + data = yaml.load(stream) if data == None: continue @@ -252,7 +250,7 @@ class ReleaseApp(cliapp.Application): print('Running test: ' + data['name']) for cmd in data['commands']: print('$ ' + cmd) - instance.runcmd(shlex.split(cmd), stdout=self.output) + instance.runcmd(['sh', '-c', cmd], stdout=self.output) def deploy_and_test_systems(self, tests): """Run the deployments and tests""" -- cgit v1.2.1