aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/generator_alerts.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2020-05-18 08:16:52 +0200
committerTibor Frank <tifrank@cisco.com>2020-05-19 04:50:54 +0000
commitdd36153562829ad84022cf5aa7746862c8f09156 (patch)
tree55a76926b9b50eb0faa7e738b8942d13e27b3d6b /resources/tools/presentation/generator_alerts.py
parentde08ebfec25d2d9bb3f3b46c07a5bcb9efd24d1c (diff)
Trending: CSIT-1717: Add links from dashboard to graphs
+ fix TB names in alerts Change-Id: Ia10e9b82b57e90f7ae4592bd6ecf8b71dea71cc8 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/generator_alerts.py')
-rw-r--r--resources/tools/presentation/generator_alerts.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py
index b0606b6fd7..8e4f31e4cf 100644
--- a/resources/tools/presentation/generator_alerts.py
+++ b/resources/tools/presentation/generator_alerts.py
@@ -20,6 +20,7 @@
import smtplib
import logging
+import re
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
@@ -346,7 +347,18 @@ class Alerting:
)
text = u""
- for idx, test_set in enumerate(alert.get(u"include", [])):
+ for idx, test_set in enumerate(alert.get(u"include", list())):
+ try:
+ test_set_short = re.search(
+ re.compile(r'(\dn-(skx|clx|hsw|tsh|dnv)-.*)'),
+ test_set
+ ).group(1)
+ except (AttributeError, IndexError):
+ logging.error(
+ f"The test set {test_set} does not include information "
+ f"about test bed. Using empty string instead."
+ )
+ test_set_short = u""
build, version, passed, failed, failed_tests = \
self._get_compressed_failed_tests(alert, test_set)
if build is None:
@@ -356,16 +368,15 @@ class Alerting:
if ret_code != 0:
build_nr = u''
text += (
- f"\n\nNo input data available for "
- f"{u'-'.join(test_set.split('-')[-2:])}. See CSIT build "
- f"{alert[u'urls'][idx]}/{build_nr} for more information.\n"
+ f"\n\nNo input data available for {test_set_short}. "
+ f"See CSIT build {alert[u'urls'][idx]}/{build_nr} for more "
+ f"information.\n"
)
continue
text += (
- f"\n\n{test_set.split('-')[-2]}-{test_set.split('-')[-1]}, "
- f"{failed} tests failed, "
- f"{passed} tests passed, CSIT build: "
- f"{alert[u'urls'][idx]}/{build}, VPP version: {version}\n\n"
+ f"\n\n{test_set_short}, {failed} tests failed, {passed} tests "
+ f"passed, CSIT build: {alert[u'urls'][idx]}/{build}, "
+ f"VPP version: {version}\n\n"
)
class MaxLens():
@@ -414,7 +425,7 @@ class Alerting:
)
gression_hdr = (
- f"\n\n{test_set.split(u'-')[-2]}-{test_set.split(u'-')[-1]}, "
+ f"\n\n{test_set_short}, "
f"CSIT build: {alert[u'urls'][idx]}/{build}, "
f"VPP version: {version}\n\n"
)