Skip to content

Commit

Permalink
guest-tools/win: test upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Tu Dinh committed Nov 4, 2024
1 parent 239928b commit a620e3a
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion tests/guest-tools/win/test_guest_tools_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a620e3a

Please sign in to comment.