From a620e3a8dfe951faa2f09eb56816cd9aa2e6dbf8 Mon Sep 17 00:00:00 2001 From: Tu Dinh Date: Mon, 4 Nov 2024 14:48:50 +0100 Subject: [PATCH] guest-tools/win: test upgrade --- tests/guest-tools/win/test_guest_tools_win.py | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/guest-tools/win/test_guest_tools_win.py b/tests/guest-tools/win/test_guest_tools_win.py index 1b1eb7d2..bf5d11b4 100644 --- a/tests/guest-tools/win/test_guest_tools_win.py +++ b/tests/guest-tools/win/test_guest_tools_win.py @@ -35,10 +35,11 @@ def install_guest_tools(vm: VM, action: PowerAction, check: bool = True): else: if check: raise Exception(f"Cannot check exit code with {action} action") + msiexec_cmd = " ".join(msiexec_args) install_cmd = [ # when powershell runs msiexec it doesn't wait for it to end unlike ssh # it only waits for stdin closing so we need Start-Process -Wait here - f"Start-Process -Wait msiexec.exe -ArgumentList '{" ".join(msiexec_args)}'" + f"Start-Process -Wait msiexec.exe -ArgumentList '{msiexec_cmd}'" ] if action != PowerAction.Nothing: install_cmd += ["Stop-Computer -Force"] @@ -248,6 +249,42 @@ def vm_install_xcpng_v8_tools(self, vm_instance: VM): ) return vm_instance + @pytest.fixture + def vm_install_xcpng_v9_tools(self, vm_instance: VM): + vm = vm_instance + + vm.insert_cd("other-guest-tools-win.iso") + time.sleep(5) + + logging.info("Install VM root certs") + vm.ssh( + [ + "certutil", + "-addstore", + "-f", + "Root", + "D:/xcp-ng-9.0.9000/testsign/XCP-ng_Test_Signer.crt", + ] + ) + vm.ssh( + [ + "certutil", + "-addstore", + "-f", + "TrustedPublisher", + "D:/xcp-ng-9.0.9000/testsign/XCP-ng_Test_Signer.crt", + ] + ) + + vm.eject_cd() + + install_other_drivers( + vm, + "xcp-ng-9.0.9000\\package\\XenDrivers-x64.msi", + is_msi=True, + ) + return vm + @pytest.fixture def vm_install_wu_drivers(self, vm_prepared: VM): (vm, snapshot) = vm_prepared @@ -297,6 +334,11 @@ def test_install_with_xcpng_v8_tools(self, vm_install_xcpng_v8_tools: VM): ) assert exitcode == ERROR_INSTALL_FAILURE + def test_upgrade_with_xcpng_v9_tools(self, vm_install_xcpng_v9_tools: VM): + vm = vm_install_xcpng_v9_tools + install_cert_and_tools(vm, PowerAction.Reboot, check=False) + assert is_drivers_installed(vm) + def test_install_with_citrix_wu(self, vm_install_wu_drivers: VM): exitcode = install_cert_and_tools( vm_install_wu_drivers, PowerAction.Nothing, check=False