aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqi liang <liangqi1@huawei.com>2015-11-03 02:49:57 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-11-03 02:49:57 +0000
commit6cf230d8c1613fa1ce108419a75f78ba8b42a0c0 (patch)
tree898790babfdfb9ee12e137718abf1585a79ed91e
parentb1eb58006197c7a41aa5f1e2c2db465bb2f0dbc3 (diff)
parent377fa4dfa142b0bc7e8be92e442199456993fe9d (diff)
Merge "Avoid the ValueError exception for a ping timeout."
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 34278b90f..c62c79e54 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -67,12 +67,15 @@ class Ping(base.Scenario):
if exit_status != 0:
raise RuntimeError(stderr)
- result["rtt"] = float(stdout)
+ if stdout:
+ result["rtt"] = float(stdout)
- if "sla" in self.scenario_cfg:
- sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
- assert result["rtt"] <= sla_max_rtt, "rtt %f > sla:max_rtt(%f); " % \
- (result["rtt"], sla_max_rtt)
+ if "sla" in self.scenario_cfg:
+ sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
+ assert result["rtt"] <= sla_max_rtt, "rtt %f > sla:max_rtt(%f); " % \
+ (result["rtt"], sla_max_rtt)
+ else:
+ LOG.error("ping '%s' '%s' timeout", options, destination)
def _test():