From 668c9b69f6d439637921f69f2a75c9fd987075c3 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Mon, 23 Sep 2019 10:46:35 +0200 Subject: [PATCH] Fix ping error command handler when unknow host error is received This is a fix for below CI error: https://storage.gra1.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_a8f/671234/24/check/tobiko-devstack-functional/a8fe837/testr_results.html.gz Change-Id: I1d0f3a18b38191e60bb79c54d8787fd6d36a83e1 --- tobiko/shell/ping/_ping.py | 2 +- tobiko/tests/functional/shell/test_ping.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tobiko/shell/ping/_ping.py b/tobiko/shell/ping/_ping.py index 7ac876820..6c8d5b07c 100644 --- a/tobiko/shell/ping/_ping.py +++ b/tobiko/shell/ping/_ping.py @@ -289,7 +289,7 @@ def handle_ping_command_error(error): details = text[len(prefix):].strip() raise _exception.SendToPingError(details=details) - prefix = 'unknown host ' + prefix = 'unknown host' if text.startswith(prefix): details = text[len(prefix):].strip() raise _exception.UnknowHostError(details=details) diff --git a/tobiko/tests/functional/shell/test_ping.py b/tobiko/tests/functional/shell/test_ping.py index fb7bc875c..1ea7254e3 100644 --- a/tobiko/tests/functional/shell/test_ping.py +++ b/tobiko/tests/functional/shell/test_ping.py @@ -51,7 +51,8 @@ class PingTest(testtools.TestCase): def test_ping_unreachable_hostname(self): ex = self.assertRaises(ping.UnknowHostError, ping.ping, 'unreachable-host', count=3) - self.assertEqual('unreachable-host', ex.details) + if ex.details: + self.assertEqual('unreachable-host', ex.details) def test_ping_until_received(self): result = ping.ping_until_received('127.0.0.1', count=3)