Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(test): Delete duplicate function definition #3752

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 3 additions & 11 deletions tests/framework/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import subprocess
from pathlib import Path

from framework.utils import get_kernel_version
from framework.utils_cpuid import get_cpu_codename, get_cpu_model_name, get_cpu_vendor
from framework.utils_imdsv2 import imdsv2_get

Expand All @@ -22,15 +23,6 @@ def run_cmd(cmd):
return subprocess.check_output(cmd, shell=True).decode().strip()


def get_kernel_version(level):
"""Return the current kernel version in format `major.minor.patch`."""
linux_version = platform.release()
# 5.15.0-56-generic
# major, minor, patch
mmp = linux_version.split("-")[0].split(".")
return ".".join(mmp[:level])


def get_os_version():
"""Get the OS version

Expand All @@ -56,9 +48,9 @@ def __init__(self):
)
self.host_linux_full_version = platform.release()
# major.minor
self.host_linux_version = get_kernel_version(2)
self.host_linux_version = get_kernel_version(1)
# major.minor.patch
self.host_linux_patch = get_kernel_version(3)
self.host_linux_patch = get_kernel_version(2)
self.os = get_os_version()
self.libc_ver = "-".join(platform.libc_ver())
self.git_commit_id = run_cmd("git rev-parse HEAD")
Expand Down
5 changes: 2 additions & 3 deletions tests/integration_tests/functional/test_rng.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import pytest

from framework.artifacts import NetIfaceConfig
from framework.properties import get_kernel_version
from framework.utils import check_entropy
from framework.utils import check_entropy, get_kernel_version
from framework.utils_cpuid import get_instance_type

INSTANCE_TYPE = get_instance_type()
HOST_KERNEL = get_kernel_version(level=2)
HOST_KERNEL = get_kernel_version(level=1)


def _microvm_basic_config(microvm):
Expand Down