-
Couldn't load subscription status.
- Fork 6
Add DMC tests and extra Windows guest tool tests #348
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
base: master
Are you sure you want to change the base?
Changes from all commits
68e0646
c857891
46414fc
88d72b5
2cc1730
dd26f0f
b478670
e774e16
02529e4
ac1a1f8
d42d006
85bc29d
12fb0d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
stormi marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,28 @@ | ||
| import pytest | ||
|
|
||
| import logging | ||
| import time | ||
|
|
||
| from . import PowerAction, wait_for_vm_running_and_ssh_up_without_tools | ||
| from lib.commands import SSHCommandFailed | ||
| from lib.common import wait_for | ||
| from lib.vm import VM | ||
|
|
||
| from . import ( | ||
| WINDOWS_SHUTDOWN_COMMAND, | ||
| PowerAction, | ||
| check_vm_dns, | ||
| set_vm_dns, | ||
| vif_has_rss, | ||
| wait_for_vm_running_and_ssh_up_without_tools, | ||
| ) | ||
| from .guest_tools import ( | ||
| ERROR_INSTALL_FAILURE, | ||
| install_guest_tools, | ||
| uninstall_guest_tools, | ||
| ) | ||
|
|
||
| from typing import Any, Tuple | ||
|
|
||
| # Requirements: | ||
| # - XCP-ng >= 8.2. | ||
| # | ||
|
|
@@ -55,38 +69,80 @@ | |
| @pytest.mark.multi_vms | ||
| @pytest.mark.usefixtures("windows_vm") | ||
| class TestGuestToolsWindows: | ||
| def test_tools_after_reboot(self, vm_install_test_tools_per_test_class): | ||
| def test_drivers_detected(self, vm_install_test_tools_per_test_class: VM): | ||
| vm = vm_install_test_tools_per_test_class | ||
| assert vm.are_windows_tools_working() | ||
|
|
||
| def test_drivers_detected(self, vm_install_test_tools_per_test_class): | ||
| def test_vif_replug(self, vm_install_test_tools_per_test_class: VM): | ||
| vm = vm_install_test_tools_per_test_class | ||
| assert vm.are_windows_tools_working() | ||
| vifs = vm.vifs() | ||
| for vif in vifs: | ||
| vif.unplug() | ||
| # HACK: Allow some time for the unplug to settle. If not, Windows guests have a tendency to explode. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a ticket for that explosion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there isn't one, only a problem revealed during debugging. It's already being tracked internally. |
||
| time.sleep(5) | ||
| vif.plug() | ||
stormi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| wait_for(vm.is_ssh_up, "Wait for SSH up") | ||
|
|
||
| def test_rss(self, vm_install_test_tools_per_test_class: VM): | ||
| """ | ||
| Receive-side scaling is known to be broken on some driver versions. | ||
|
|
||
| Test that RSS is functional for each NIC. | ||
| """ | ||
| vm = vm_install_test_tools_per_test_class | ||
| vifs = vm.vifs() | ||
| for vif in vifs: | ||
| assert vif_has_rss(vif) | ||
|
|
||
|
|
||
| @pytest.mark.multi_vms | ||
| @pytest.mark.usefixtures("windows_vm") | ||
| class TestGuestToolsWindowsDestructive: | ||
| def test_uninstall_tools(self, vm_install_test_tools_no_reboot): | ||
| def test_uninstall_tools(self, vm_install_test_tools_no_reboot: VM): | ||
| vm = vm_install_test_tools_no_reboot | ||
| vm.reboot() | ||
| vm.ssh(WINDOWS_SHUTDOWN_COMMAND) | ||
| wait_for(vm.is_halted, "Shutdown VM") | ||
|
|
||
| vm.start() | ||
| wait_for_vm_running_and_ssh_up_without_tools(vm) | ||
|
|
||
| set_vm_dns(vm) | ||
| logging.info("Uninstall Windows PV drivers") | ||
| uninstall_guest_tools(vm, action=PowerAction.Reboot) | ||
| logging.info("Check tools uninstalled") | ||
| assert vm.are_windows_tools_uninstalled() | ||
| check_vm_dns(vm) | ||
|
|
||
| def test_uninstall_tools_early(self, vm_install_test_tools_no_reboot): | ||
| def test_uninstall_tools_early(self, vm_install_test_tools_no_reboot: VM): | ||
| vm = vm_install_test_tools_no_reboot | ||
| logging.info("Uninstall Windows PV drivers before rebooting") | ||
| uninstall_guest_tools(vm, action=PowerAction.Reboot) | ||
| assert vm.are_windows_tools_uninstalled() | ||
|
|
||
| def test_install_with_other_tools(self, vm_install_other_drivers, guest_tools_iso): | ||
| def test_install_with_other_tools( | ||
| self, vm_install_other_drivers: Tuple[VM, dict[str, Any]], guest_tools_iso: dict[str, Any] | ||
| ): | ||
| vm, param = vm_install_other_drivers | ||
| if param["upgradable"]: | ||
| pytest.xfail("Upgrades may require multiple reboots and are not testable yet") | ||
| install_guest_tools(vm, guest_tools_iso, PowerAction.Reboot, check=False) | ||
| assert vm.are_windows_tools_working() | ||
| else: | ||
| exitcode = install_guest_tools(vm, guest_tools_iso, PowerAction.Nothing, check=False) | ||
| assert exitcode == ERROR_INSTALL_FAILURE | ||
|
|
||
| @pytest.mark.usefixtures("uefi_vm") | ||
| def test_uefi_vm_suspend_refused_without_tools(self, running_unsealed_windows_vm: VM): | ||
| vm = running_unsealed_windows_vm | ||
| with pytest.raises(SSHCommandFailed, match="lacks the feature"): | ||
| vm.suspend() | ||
| wait_for_vm_running_and_ssh_up_without_tools(vm) | ||
|
|
||
| # Test of the unplug rework, where the driver must remain activated even if the device ID changes. | ||
| # Also serves as a "close-enough" test of vendor device toggling. | ||
| def test_toggle_device_id(self, running_unsealed_windows_vm: VM, guest_tools_iso: dict[str, Any]): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the objective of this test? I understand we want to make sure the VM still boots after changing the device ID, but why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a test of our driver, which after the unplug rework must remain activated even if the device ID changes. It also serves as a proxy for device ID changes if the Windows Update option was toggled. It's not an exact reproduction of the situation, but since we don't yet support the C200 device, it's good enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment above the test function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Also moved the device ID assert up one line. |
||
| vm = running_unsealed_windows_vm | ||
| assert vm.param_get("platform", "device_id") == "0002" | ||
| install_guest_tools(vm, guest_tools_iso, PowerAction.Shutdown, check=False) | ||
| vm.param_set("platform", "0001", "device_id") | ||
| vm.start() | ||
| vm.wait_for_vm_running_and_ssh_up() | ||
Uh oh!
There was an error while loading. Please reload this page.