From b3b3cab746483e59f137d1acff87ad0a3afa08ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Mon, 21 Aug 2023 17:10:17 +0200 Subject: [PATCH] ci: decorate metrics with the host OS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, kernel version has been enough to disambiguate the OS, but by being explicit we can disambiguate in the case we have distinct OSes with the same kernel. Signed-off-by: Pablo Barbáchano --- tests/framework/properties.py | 19 +++++++++++++++++++ .../performance/test_boottime.py | 1 + 2 files changed, 20 insertions(+) diff --git a/tests/framework/properties.py b/tests/framework/properties.py index f3572c7b1bb..d934e5d6296 100644 --- a/tests/framework/properties.py +++ b/tests/framework/properties.py @@ -35,6 +35,24 @@ def get_os_version(): return match.group(1) +def get_host_os(kv: str = None): + """ + Extract OS information from the kernel if it's there. + + This only works for AL2 and AL2023 + + >>> get_host_os("6.1.41-63.118.amzn2023.x86_64") + amzn2023 + """ + if kv is None: + kv = platform.release() + parts = kv.split("-") + misc = parts[1].split(".") + if len(misc) > 2 and misc[2] in {"amzn2", "amzn2023"}: + return misc[2] + return None + + class GlobalProps: """Class to hold metadata about the testrun environment""" @@ -52,6 +70,7 @@ def __init__(self): # major.minor.patch self.host_linux_patch = get_kernel_version(2) self.os = get_os_version() + self.host_os = get_host_os() self.libc_ver = "-".join(platform.libc_ver()) self.git_commit_id = run_cmd("git rev-parse HEAD") self.git_branch = run_cmd("git show -s --pretty=%D HEAD") diff --git a/tests/integration_tests/performance/test_boottime.py b/tests/integration_tests/performance/test_boottime.py index 2a9f1e41a0c..96e7599e836 100644 --- a/tests/integration_tests/performance/test_boottime.py +++ b/tests/integration_tests/performance/test_boottime.py @@ -26,6 +26,7 @@ DIMENSIONS = { "instance": global_props.instance, "cpu_model": global_props.cpu_model, + "host_os": global_props.host_os, "host_kernel": "linux-" + global_props.host_linux_version, }