aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/vPing/CI/libraries
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-02-02 13:59:56 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2016-02-02 13:59:56 +0100
commit5bb53025a593bbda834ef6ad325faba5aa073f7f (patch)
treee8f145db8d7187528ddfb90830cd5efe3037bffb /testcases/vPing/CI/libraries
parent2e22f175cd3a00db35d28dc97bd87de5362e802f (diff)
Report vPing timeouts to the DB with duration = 0 and test status=NOK
JIRA: FUNCTEST-132 Change-Id: Ida0c485504fd07db29b0c33ac59da6944da303a9 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/vPing/CI/libraries')
-rw-r--r--testcases/vPing/CI/libraries/vPing.py36
-rw-r--r--testcases/vPing/CI/libraries/vPing2.py39
2 files changed, 38 insertions, 37 deletions
diff --git a/testcases/vPing/CI/libraries/vPing.py b/testcases/vPing/CI/libraries/vPing.py
index 0b09b6d4..1368bbec 100644
--- a/testcases/vPing/CI/libraries/vPing.py
+++ b/testcases/vPing/CI/libraries/vPing.py
@@ -270,6 +270,20 @@ def cleanup(nova, neutron, image_id, network_dic, port_id1, port_id2):
return True
+def push_results(start_time_ts, duration, test_status):
+ try:
+ logger.debug("Pushing result into DB...")
+ scenario = functest_utils.get_scenario(logger)
+ pod_name = functest_utils.get_pod_name(logger)
+ functest_utils.push_results_to_db(TEST_DB,
+ "vPing_userdata",
+ logger, pod_name, scenario,
+ payload={'timestart': start_time_ts,
+ 'duration': duration,
+ 'status': test_status})
+ except:
+ logger.error("Error pushing results into Database '%s'" % sys.exc_info()[0])
+
def main():
@@ -466,31 +480,17 @@ def main():
logger.info("vPing OK")
test_status = "OK"
elif EXIT_CODE == -2:
+ duration = 0
logger.info("Userdata is not supported in nova boot. Aborting test...")
else:
+ duration = 0
logger.error("vPing FAILED")
cleanup(nova_client, neutron_client, image_id, network_dic,
port_id1, port_id2)
- try:
- if args.report and EXIT_CODE != -2:
- # Don't report if userdata is not supported
- logger.debug("Push result into DB")
- # TODO check path result for the file
- scenario = functest_utils.get_scenario(logger)
- pod_name = functest_utils.get_pod_name(logger)
- functest_utils.push_results_to_db(TEST_DB,
- "vPing_userdata",
- logger, pod_name, scenario,
- payload={'timestart': start_time_ts,
- 'duration': duration,
- 'status': test_status})
- # with open("vPing-result.json", "w") as outfile:
- # json.dump({'timestart': start_time_ts, 'duration': duration,
- # 'status': test_status}, outfile, indent=4)
- except:
- logger.error("Error pushing results into Database '%s'" % sys.exc_info()[0])
+ if args.report:
+ push_results(start_time_ts, duration, test_status)
exit(EXIT_CODE)
diff --git a/testcases/vPing/CI/libraries/vPing2.py b/testcases/vPing/CI/libraries/vPing2.py
index a60ae000..c14be43a 100644
--- a/testcases/vPing/CI/libraries/vPing2.py
+++ b/testcases/vPing/CI/libraries/vPing2.py
@@ -276,6 +276,20 @@ def cleanup(nova, neutron, image_id, network_dic, port_id1, port_id2):
return True
+def push_results(start_time_ts, duration, test_status):
+ try:
+ logger.debug("Pushing result into DB...")
+ scenario = functest_utils.get_scenario(logger)
+ pod_name = functest_utils.get_pod_name(logger)
+ functest_utils.push_results_to_db(TEST_DB,
+ "vPing",
+ logger, pod_name, scenario,
+ payload={'timestart': start_time_ts,
+ 'duration': duration,
+ 'status': test_status})
+ except:
+ logger.error("Error pushing results into Database '%s'" % sys.exc_info()[0])
+
def main():
@@ -530,33 +544,20 @@ def main():
logger.debug("Pinging %s. Waiting for response..." % IP_1)
sec += 1
- cleanup(nova_client, neutron_client, image_id, network_dic,
- port_id1, port_id2)
test_status = "NOK"
if EXIT_CODE == 0:
logger.info("vPing OK")
test_status = "OK"
else:
+ duration = 0
logger.error("vPing FAILED")
- try:
- if args.report:
- logger.debug("Push result into DB")
- # TODO check path result for the file
- scenario = functest_utils.get_scenario(logger)
- pod_name = functest_utils.get_pod_name(logger)
- functest_utils.push_results_to_db(TEST_DB,
- "vPing",
- logger, pod_name, scenario,
- payload={'timestart': start_time_ts,
- 'duration': duration,
- 'status': test_status})
- # with open("vPing-result.json", "w") as outfile:
- # json.dump({'timestart': start_time_ts, 'duration': duration,
- # 'status': test_status}, outfile, indent=4)
- except:
- logger.error("Error pushing results into Database '%s'" % sys.exc_info()[0])
+ cleanup(nova_client, neutron_client, image_id, network_dic,
+ port_id1, port_id2)
+
+ if args.report:
+ push_results(start_time_ts, duration, test_status)
exit(EXIT_CODE)