diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-04-21 12:46:38 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-04-21 12:50:21 +0200 |
commit | 6279d9372d0a1827bb14e365cd02e9888941315d (patch) | |
tree | a1a9021526696abcbcaa7f28fe12bc4b80326d38 | |
parent | aef4f03c7031541c678796704f6636ae70ac799d (diff) |
Add timeouts in juju_epc
juju_epc still hangs if OpenStack isn't well deployed [1].
As releng doesn't publish logs if the job is aborted, timeout has to
be added mostly everywhere.
[1] https://build.opnfv.org/ci/view/functest/job/functest-apex-baremetal-daily-fraser/31/console
Change-Id: I0296cd811bda0234aab98f184b3ab247a5b32017
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | functest/opnfv_tests/vnf/epc/juju_epc.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index 1ba883d40..50253ccac 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -82,7 +82,7 @@ class JujuEpc(vnf.VnfOnBoarding): __logger = logging.getLogger(__name__) - juju_wait_timeout = '3600' + juju_timeout = '3600' def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -287,7 +287,8 @@ class JujuEpc(vnf.VnfOnBoarding): name=image_name, image_user='cloud', img_format='qcow2', image_file=image_file)) image_id = image_creator.create().id - cmd = ['juju', 'metadata', 'generate-image', '-d', '/root', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'metadata', 'generate-image', '-d', '/root', '-i', image_id, '-s', image_name, '-r', self.snaps_creds.region_name, '-u', self.public_auth_url] @@ -295,7 +296,8 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("%s\n%s", " ".join(cmd), output) self.created_object.append(image_creator) self.__logger.info("Network ID : %s", net_id) - cmd = ['juju', 'bootstrap', 'abot-epc', 'abot-controller', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'bootstrap', 'abot-epc', 'abot-controller', '--metadata-source', '/root', '--constraints', 'mem=2G', '--bootstrap-series', 'xenial', @@ -334,11 +336,12 @@ class JujuEpc(vnf.VnfOnBoarding): flavor_creator.create() self.created_object.append(flavor_creator) self.__logger.info("Deploying Abot-epc bundle file ...") - cmd = ['juju', 'deploy', '{}'.format(descriptor.get('file_name'))] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'deploy', '{}'.format(descriptor.get('file_name'))] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Waiting for instances .....") - cmd = ['timeout', '-t', JujuEpc.juju_wait_timeout, 'juju-wait'] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, 'juju-wait'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Deployed Abot-epc on Openstack") @@ -364,12 +367,14 @@ class JujuEpc(vnf.VnfOnBoarding): if not self.check_app(app): return False self.__logger.info("Copying the feature files to Abot_node ") - cmd = ['juju', 'scp', '--', '-r', '-v', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'scp', '--', '-r', '-v', '{}/featureFiles'.format(self.case_dir), 'abot-epc-basic/0:~/'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Copying the feature files in Abot_node ") - cmd = ['juju', 'ssh', 'abot-epc-basic/0', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'ssh', 'abot-epc-basic/0', 'sudo', 'rsync', '-azvv', '~/featureFiles', '/etc/rebaca-test-suite/featureFiles'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) @@ -380,16 +385,18 @@ class JujuEpc(vnf.VnfOnBoarding): """Run test on ABoT.""" start_time = time.time() self.__logger.info("Running VNF Test cases....") - cmd = ['juju', 'run-action', 'abot-epc-basic/0', 'run', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'run-action', 'abot-epc-basic/0', 'run', 'tagnames={}'.format(self.details['test_vnf']['tag_name'])] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) - cmd = ['timeout', '-t', JujuEpc.juju_wait_timeout, 'juju-wait'] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, 'juju-wait'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) duration = time.time() - start_time self.__logger.info("Getting results from Abot node....") - cmd = ['juju', 'scp', '--', '-v', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'scp', '--', '-v', 'abot-epc-basic/0:' '/var/lib/abot-epc-basic/artifacts/TestResults.json', '{}/.'.format(self.res_dir)] @@ -417,7 +424,8 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.debug("%s\n%s", " ".join(cmd), output) if not self.orchestrator['requirements']['preserve_setup']: self.__logger.info("Destroying Orchestrator...") - cmd = ['juju', 'destroy-controller', '-y', 'abot-controller', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'destroy-controller', '-y', 'abot-controller', '--destroy-all-models'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) |