diff options
author | boucherv <valentin.boucher@orange.com> | 2016-07-13 16:48:28 +0200 |
---|---|---|
committer | boucherv <valentin.boucher@orange.com> | 2016-07-13 17:30:22 +0200 |
commit | 4cc4bc0f88091246ac1bf3dcea89e4b281d64e1e (patch) | |
tree | 4e9fe02e9f7ee40d6375be83455b997ab6b7ed61 | |
parent | 94cb165d12487fccd83864788728c6f103b4cb50 (diff) |
Improve timeout management with python
JIRA: FUNCTEST-368
Change-Id: I9f7a6adc807c63694fc5d9fb8a81ad1d2d9d3225
Signed-off-by: boucherv <valentin.boucher@orange.com>
-rw-r--r-- | docker/requirements.pip | 3 | ||||
-rw-r--r-- | testcases/vnf/vIMS/orchestrator.py | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/docker/requirements.pip b/docker/requirements.pip index 88fa74de..fa6681e8 100644 --- a/docker/requirements.pip +++ b/docker/requirements.pip @@ -22,4 +22,5 @@ Flask==0.10.1 xmltodict==0.9.2 scp==0.10.2 paramiko==1.16.0 -python-congressclient==1.3.0
\ No newline at end of file +python-congressclient==1.3.0 +subprocess32
\ No newline at end of file diff --git a/testcases/vnf/vIMS/orchestrator.py b/testcases/vnf/vIMS/orchestrator.py index c61f654c..f52afe1b 100644 --- a/testcases/vnf/vIMS/orchestrator.py +++ b/testcases/vnf/vIMS/orchestrator.py @@ -10,7 +10,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ######################################################################## -import subprocess +import subprocess32 as subprocess import os import shutil import yaml @@ -109,7 +109,7 @@ class orchestrator: script += ("cfy local create-requirements -o requirements.txt " + "-p openstack-manager-blueprint.yaml; ") script += "pip install -r requirements.txt; " - script += ("timeout 1800 cfy bootstrap --install-plugins " + + script += ("cfy bootstrap --install-plugins " + "-p openstack-manager-blueprint.yaml -i inputs.yaml; ") cmd = "/bin/bash -c '" + script + "'" error = execute_command(cmd, self.logger) @@ -199,7 +199,7 @@ class orchestrator: self.logger.error("Clearwater undeployment failed") -def execute_command(cmd, logger): +def execute_command(cmd, logger, timeout=1800): """ Execute Linux command """ @@ -207,7 +207,8 @@ def execute_command(cmd, logger): logger.debug('Executing command : {}'.format(cmd)) output_file = "output.txt" f = open(output_file, 'w+') - p = subprocess.call(cmd, shell=True, stdout=f, stderr=subprocess.STDOUT) + p = subprocess.call(cmd, shell=True, stdout=f, + stderr=subprocess.STDOUT, timeout=timeout) f.close() f = open(output_file, 'r') result = f.read() |