aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/check_os.sh6
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py13
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_rally.py13
-rw-r--r--testcases/vPing/CI/libraries/vPing.py18
4 files changed, 35 insertions, 15 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/check_os.sh b/testcases/VIM/OpenStack/CI/libraries/check_os.sh
index 1327eff5f..63d4ea696 100755
--- a/testcases/VIM/OpenStack/CI/libraries/check_os.sh
+++ b/testcases/VIM/OpenStack/CI/libraries/check_os.sh
@@ -31,7 +31,7 @@ echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
verify_connectivity $publicIP $publicPort
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
- echo "ERROR: Cannot talk to the public endpoint publicIP:$publicPort ."
+ echo "ERROR: Cannot talk to the public endpoint $publicIP:$publicPort ."
echo "OS_AUTH_URL=$OS_AUTH_URL"
exit 1
fi
@@ -44,8 +44,8 @@ echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
verify_connectivity $adminIP $adminPort
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
- echo "ERROR: Cannot talk to the admin endpoint adminIP:$adminPort ."
- echo "adminURL"
+ echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
+ echo "$adminURL"
exit 1
fi
echo " ...OK"
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index b5fcd7218..13066b3df 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -21,6 +21,7 @@ import argparse
import logging
import yaml
import requests
+import subprocess
import sys
from novaclient import client as novaclient
from glanceclient import client as glanceclient
@@ -53,6 +54,7 @@ args = parser.parse_args()
client_dict = {}
+FNULL = open(os.devnull, 'w')
""" logging configuration """
logger = logging.getLogger("run_rally")
logger.setLevel(logging.DEBUG)
@@ -208,8 +210,15 @@ def run_task(test_name):
"--task {} ".format(task_file) + \
"--task-args \"{}\" ".format(build_task_args(test_name))
logger.debug('running command line : {}'.format(cmd_line))
- cmd = os.popen(cmd_line)
- task_id = get_task_id(cmd.read())
+
+ p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True)
+ result = ""
+ while p.poll() is None:
+ l = p.stdout.readline()
+ print l.replace('\n', '')
+ result += l
+
+ task_id = get_task_id(result)
logger.debug('task_id : {}'.format(task_id))
if task_id is None:
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally.py b/testcases/VIM/OpenStack/CI/libraries/run_rally.py
index d5796c1b4..b879758ca 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally.py
@@ -21,6 +21,7 @@ import argparse
import logging
import yaml
import requests
+import subprocess
import sys
from novaclient import client as novaclient
from keystoneclient.v2_0 import client as keystoneclient
@@ -47,7 +48,7 @@ parser.add_argument("-r", "--report",
args = parser.parse_args()
-
+FNULL = open(os.devnull, 'w')
""" logging configuration """
logger = logging.getLogger("run_rally")
logger.setLevel(logging.DEBUG)
@@ -173,8 +174,14 @@ def run_task(test_name):
logger.debug('Scenario fetched from : {}'.format(test_file_name))
cmd_line = "rally task start --abort-on-sla-failure {}".format(test_file_name)
logger.debug('running command line : {}'.format(cmd_line))
- cmd = os.popen(cmd_line)
- task_id = get_task_id(cmd.read())
+ p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True)
+ result = ""
+ while p.poll() is None:
+ l = p.stdout.readline()
+ print l.replace('\n', '')
+ result += l
+
+ task_id = get_task_id(result)
logger.debug('task_id : {}'.format(task_id))
if task_id is None:
diff --git a/testcases/vPing/CI/libraries/vPing.py b/testcases/vPing/CI/libraries/vPing.py
index be0d2341a..b87de850d 100644
--- a/testcases/vPing/CI/libraries/vPing.py
+++ b/testcases/vPing/CI/libraries/vPing.py
@@ -56,7 +56,7 @@ formatter = logging.Formatter('%(asctime)s - %(name)s'
ch.setFormatter(formatter)
logger.addHandler(ch)
-REPO_PATH=os.environ['repos_dir']+'/functest/'
+REPO_PATH = os.environ['repos_dir']+'/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
@@ -274,13 +274,13 @@ def cleanup(nova, neutron, image_id, network_dic, port_id1, port_id2):
def main():
creds_nova = functest_utils.get_credentials("nova")
- nova_client = novaclient.Client('2',**creds_nova)
+ nova_client = novaclient.Client('2', **creds_nova)
creds_neutron = functest_utils.get_credentials("neutron")
neutron_client = neutronclient.Client(**creds_neutron)
creds_keystone = functest_utils.get_credentials("keystone")
keystone_client = keystoneclient.Client(**creds_keystone)
glance_endpoint = keystone_client.service_catalog.url_for(service_type='image',
- endpoint_type='publicURL')
+ endpoint_type='publicURL')
glance_client = glanceclient.Client(1, glance_endpoint,
token=keystone_client.auth_token)
EXIT_CODE = -1
@@ -291,7 +291,8 @@ def main():
logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME,
GLANCE_IMAGE_PATH))
image_id = functest_utils.create_glance_image(glance_client,
- GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH)
+ GLANCE_IMAGE_NAME,
+ GLANCE_IMAGE_PATH)
if not image_id:
logger.error("Failed to create a Glance image...")
exit(-1)
@@ -419,7 +420,8 @@ def main():
if not waitVmActive(nova_client, vm2):
logger.error("Instance '%s' cannot be booted. Status is '%s'" % (
NAME_VM_2, functest_utils.get_instance_status(nova_client, vm2)))
- cleanup(nova_client, neutron_client, image_id, network_dic, port_id1, port_id2)
+ cleanup(nova_client, neutron_client, image_id, network_dic,
+ port_id1, port_id2)
return (EXIT_CODE)
else:
logger.info("Instance '%s' is ACTIVE." % NAME_VM_2)
@@ -427,6 +429,7 @@ def main():
logger.info("Waiting for ping...")
sec = 0
console_log = vm2.get_console_output()
+ duration = 0
while True:
time.sleep(1)
@@ -449,7 +452,8 @@ def main():
logger.debug("No vPing detected...")
sec += 1
- cleanup(nova_client, neutron_client, image_id, network_dic, port_id1, port_id2)
+ cleanup(nova_client, neutron_client, image_id, network_dic,
+ port_id1, port_id2)
test_status = "NOK"
if EXIT_CODE == 0:
@@ -474,7 +478,7 @@ def main():
# json.dump({'timestart': start_time_ts, 'duration': duration,
# 'status': test_status}, outfile, indent=4)
except:
- logger.error("Error pushing results into Database")
+ logger.error("Error pushing results into Database '%s'" % sys.exc_info()[0])
exit(EXIT_CODE)