From 5ec31b4e814240bdbc68985d5a4266a485e50cf9 Mon Sep 17 00:00:00 2001
From: Nicolas KAROLAK <nicolas@karolak.fr>
Date: Mon, 6 Apr 2020 09:20:07 +0000
Subject: [PATCH] add domain into warnings and errors

---
 tests/test_nginx_vhosts.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/test_nginx_vhosts.py b/tests/test_nginx_vhosts.py
index 69331ca4..a453f960 100755
--- a/tests/test_nginx_vhosts.py
+++ b/tests/test_nginx_vhosts.py
@@ -103,10 +103,10 @@ def test_vhost(
             try:
                 ip = socket.gethostbyname(domain)
             except Exception as e:
-                ip_error = f"domain: not resolved {e}"
+                ip_error = f"{domain} not resolved: {e}"
             else:
                 if ip != "127.0.0.1":
-                    ip_warning = f"domain: resolve to {ip} instead of 127.0.0.1"
+                    ip_warning = f"{domain} resolve to {ip} instead of 127.0.0.1"
             if ip_error:
                 if resolution_ignored and domain in resolution_ignored:
                     u.info(f"{ip_error} (ignored)")
@@ -137,11 +137,11 @@ def test_vhost(
                 or domain == "localhost"
                 and code not in (200, 401, 403, 404)
             ):
-                u.error(f"status: {code}, {req_time}ms")
+                u.error(f"{domain} status: {code}, {req_time}ms")
                 req_error = True
             else:
                 if req_time > 10000:
-                    u.warning(f"status: {code}, {req_time}ms")
+                    u.warning(f"{domain} status: {code}, {req_time}ms")
                     warnings += 1
                 if "mediaserver" in name and wowza_dir:
                     # test /streaming url
@@ -159,10 +159,10 @@ def test_vhost(
                     else:
                         code = req.status_code
                     if code != 200:
-                        u.error(f"streaming: {code}, {req_time}ms")
+                        u.error(f"{domain} streaming: {code}, {req_time}ms")
                         req_error = True
                     elif req_time > 10000:
-                        u.warning(f"streaming: {code}, {req_time}ms")
+                        u.warning(f"{domain} streaming: {code}, {req_time}ms")
                         warnings += 1
             tested += 1
 
-- 
GitLab