- text += ("\n\n{topo}-{arch}, "
- "{failed} tests failed, "
- "{passed} tests passed, "
- "CSIT build: {link}/{build}, "
- "VPP version: {version}\n\n".
- format(topo=test_set.split('-')[-2],
- arch=test_set.split('-')[-1],
- failed=failed,
- passed=passed,
- link=alert["urls"][idx],
- build=build,
- version=version))
- max_len_name = 0
- max_len_nics = 0
- max_len_framesizes = 0
- max_len_cores = 0
- for name, params in failed_tests.items():
- failed_tests[name]["nics"] = ",".join(sorted(params["nics"]))
- failed_tests[name]["framesizes"] = \
- ",".join(sorted(params["framesizes"]))
- failed_tests[name]["cores"] = ",".join(sorted(params["cores"]))
- if len(name) > max_len_name:
- max_len_name = len(name)
- if len(failed_tests[name]["nics"]) > max_len_nics:
- max_len_nics = len(failed_tests[name]["nics"])
- if len(failed_tests[name]["framesizes"]) > max_len_framesizes:
- max_len_framesizes = len(failed_tests[name]["framesizes"])
- if len(failed_tests[name]["cores"]) > max_len_cores:
- max_len_cores = len(failed_tests[name]["cores"])
-
- for name, params in failed_tests.items():
- text += "{name} {nics} {frames} {cores}\n".format(
- name=name + " " * (max_len_name - len(name)),
- nics=params["nics"] +
- " " * (max_len_nics - len(params["nics"])),
- frames=params["framesizes"] + " " *
- (max_len_framesizes - len(params["framesizes"])),
- cores=params["cores"] +
- " " * (max_len_cores - len(params["cores"])))
-
+ text += (
+ f"\n\n{test_set_short}, "
+ f"{failed} tests failed, "
+ f"{passed} tests passed, "
+ f"duration: {duration}, "
+ f"CSIT build: {alert[u'urls'][idx]}/{build}, "
+ f"{device} version: {version}\n\n"
+ )
+
+ class MaxLens():
+ """Class to store the max lengths of strings displayed in
+ failed tests list.
+ """
+ def __init__(self, tst_name, nics, framesizes, cores):
+ """Initialisation.
+
+ :param tst_name: Name of the test.
+ :param nics: NICs used in the test.
+ :param framesizes: Frame sizes used in the tests
+ :param cores: Cores used in th test.
+ """
+ self.name = tst_name
+ self.nics = nics
+ self.frmsizes = framesizes
+ self.cores = cores
+
+ max_len = MaxLens(0, 0, 0, 0)
+
+ for test, message in failed_tests.items():
+ for e_message, params in message.items():
+ failed_tests[test][e_message][u"nics"] = \
+ u" ".join(sorted(params[u"nics"]))
+ failed_tests[test][e_message][u"framesizes"] = \
+ u" ".join(sorted(params[u"framesizes"]))
+ failed_tests[test][e_message][u"cores"] = \
+ u" ".join(sorted(params[u"cores"]))
+ if len(test) > max_len.name:
+ max_len.name = len(test)
+ if len(failed_tests[test][e_message][u"nics"]) > \
+ max_len.nics:
+ max_len.nics = \
+ len(failed_tests[test][e_message][u"nics"])
+ if len(failed_tests[test][e_message][u"framesizes"]) > \
+ max_len.frmsizes:
+ max_len.frmsizes = \
+ len(failed_tests[test][e_message][u"framesizes"])
+ if len(failed_tests[test][e_message][u"cores"]) > \
+ max_len.cores:
+ max_len.cores = \
+ len(failed_tests[test][e_message][u"cores"])
+
+ for test, message in failed_tests.items():
+ test_added = False
+ for e_message, params in message.items():
+ if not test_added:
+ test_added = True
+ else:
+ test = ""
+ text += (
+ f"{test + u' ' * (max_len.name - len(test))} "
+ f"{params[u'nics']}"
+ f"{u' ' * (max_len.nics - len(params[u'nics']))} "
+ f"{params[u'framesizes']}"
+ f"""{u' ' * (max_len.frmsizes
+ - len(params[u'framesizes']))} """
+ f"{params[u'cores']}"
+ f"{u' ' * (max_len.cores - len(params[u'cores']))}\n"
+ )
+
+ gression_hdr = (
+ f"\n\n{test_set_short}, "
+ f"CSIT build: {alert[u'urls'][idx]}/{build}, "
+ f"{device} version: {version}\n\n"
+ )