diff --git a/tests/test_linux.py b/tests/test_linux.py index 6972396..c3f58f6 100644 --- a/tests/test_linux.py +++ b/tests/test_linux.py @@ -639,13 +639,16 @@ def test_get_facts_baremetal_vendor_model_serial(driver): platform = {"vendor": "Dell Inc.", "model": "PowerEdge R720", "serial": "ABC123", "is_vm": False} with patch.object(driver, "_collect_platform_info", return_value=platform), \ patch.object(driver, "_parse_uptime", return_value=86400), \ - patch.object(driver, "_send", side_effect=["myhost", "myhost.example.com", "Debian GNU/Linux 12", "eth0\neth1"]): + patch.object(driver, "_send", side_effect=["myhost", "myhost.example.com", "Debian GNU/Linux 12", "eth0\neth1", + "6.1.0-18-amd64"]): facts = driver.get_facts() assert facts["vendor"] == "Dell Inc." assert facts["model"] == "PowerEdge R720" assert facts["serial_number"] == "ABC123" assert facts["hostname"] == "myhost" assert facts["uptime"] == 86400 + # Booted kernel, not the newest installed one — kernel CVE relevance needs it. + assert facts["running_kernel"] == "6.1.0-18-amd64" def test_get_facts_vm_kvm(driver): @@ -655,7 +658,8 @@ def test_get_facts_vm_kvm(driver): } with patch.object(driver, "_collect_platform_info", return_value=platform), \ patch.object(driver, "_parse_uptime", return_value=3600), \ - patch.object(driver, "_send", side_effect=["vmhost", "vmhost.local", "Ubuntu 22.04 LTS", "eth0"]): + patch.object(driver, "_send", side_effect=["vmhost", "vmhost.local", "Ubuntu 22.04 LTS", "eth0", + "5.15.0-91-generic"]): facts = driver.get_facts() assert facts["vendor"] == "KVM" assert facts["model"] == "Virtual Machine" @@ -666,7 +670,7 @@ def test_get_facts_fallback_vendor_when_dmi_empty(driver): platform = {"vendor": "", "model": "", "serial": "", "is_vm": False} with patch.object(driver, "_collect_platform_info", return_value=platform), \ patch.object(driver, "_parse_uptime", return_value=0), \ - patch.object(driver, "_send", side_effect=["host", "host.local", "Alpine Linux 3.19", "eth0"]): + patch.object(driver, "_send", side_effect=["host", "host.local", "Alpine Linux 3.19", "eth0", "6.6.7-0-lts"]): facts = driver.get_facts() assert facts["vendor"] == "Linux" # fallback to VENDOR class attribute