This repository was archived by the owner on Apr 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Add Windows test #201
Merged
Merged
Add Windows test #201
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a46b746
tests: Add Windows domain description
scholzp 83d5ebb
tests: Copy images only as they are needed
scholzp 2d23901
tests: Increase the disk size of ControllerVM
scholzp 61bc19d
tests: Add a test suite for Windows tests
scholzp 87bd8b9
tests: Add Windows test suite with CPU profiles
scholzp d087f91
docs: Add documentation for the Windows image
scholzp 129593a
readme: Add documentation for new Windows test suites
scholzp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Windows Server 2025 Images Provision | ||
|
|
||
| * The image originates from a standard Windows Server 2025 installation | ||
| * An SSH server is running, it was activated by executing the command below | ||
| * The firewall is turned off as described in the basic setup | ||
| * As a side note, Windows does not support Post Quantum KEX algorithms. | ||
|
|
||
| ```powershell | ||
| Start-Service sshd | ||
| Set-Service -Name sshd -StartupType Automatic | ||
| ``` | ||
|
|
||
| * There exists a script that binds the IP address 192.186.1.2 to the MAC `52:54:00:e5:b8:01` | ||
| * This script can be found at `C:\bind-mac.ps1` | ||
| * It contains the following code: | ||
|
|
||
| ```powershell | ||
| $targetMac = "52-54-00-E5-B8-01" | ||
|
|
||
| for ($i=0; $i -lt 10; $i++) { | ||
| $iface = Get-NetAdapter | Where-Object { | ||
| $_.MacAddress -eq $targetMac -and $_.Status -eq "Up" | ||
| } | ||
| if ($iface) { break } | ||
| Start-Sleep -Seconds 2 | ||
| } | ||
|
|
||
| if ($iface) { | ||
| New-NetIPAddress -InterfaceIndex $iface.ifIndex ` | ||
| -IPAddress 192.168.1.2 -PrefixLength 24 ` | ||
| -DefaultGateway 192.168.1.1 -ErrorAction SilentlyContinue | ||
| } | ||
| ``` | ||
|
|
||
| * There is a service scheduled that runs the binding script. It was scheduled with the command below. | ||
| * Running the script on startup is necessary as we can guarantee this way that the interface with the correct MAC receives the desired IP | ||
| * Windows creates Interfaces in a weird way, so we cannot guarantee that the VM has the same interface as when we provisioned the image in Qemu | ||
| * Otherwise running `bind-mac.ps1` once would be enough | ||
|
|
||
| ```powershell | ||
| schtasks /create /tn "BindIPToMAC" ` | ||
| /tr "powershell -ExecutionPolicy Bypass -File C:\bind-mac.ps1" ` | ||
| /sc onstart /ru SYSTEM | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import unittest | ||
|
|
||
| # Following import statement allows for proper python IDE support and proper | ||
| # nix build support. The duplicate listing of imported functions is a bit | ||
| # unfortunate, but it seems to be the best compromise. This way the python IDE | ||
| # support works out of the box in VSCode and IntelliJ without requiring | ||
| # additional IDE configuration. | ||
| try: | ||
| from ..test_helper.test_helper import ( # type: ignore | ||
| LibvirtTestsBase, | ||
| initialComputeVMSetup, | ||
| initialControllerVMSetup, | ||
| wait_for_ssh, | ||
| ) | ||
| except Exception: | ||
| from test_helper import ( | ||
| LibvirtTestsBase, | ||
| initialComputeVMSetup, | ||
| initialControllerVMSetup, | ||
| wait_for_ssh, | ||
| ) | ||
|
|
||
| # pyright: reportPossiblyUnboundVariable=false | ||
|
|
||
| # Following is required to allow proper linting of the python code in IDEs. | ||
| # Because certain functions like start_all() and certain objects like computeVM | ||
| # or other machines are added by Nix, we need to provide certain stub objects | ||
| # in order to allow the IDE to lint the python code successfully. | ||
| if "start_all" not in globals(): | ||
| from ..test_helper.test_helper.nixos_test_stubs import ( # type: ignore | ||
| computeVM, | ||
| controllerVM, | ||
| start_all, | ||
| ) | ||
|
|
||
|
|
||
| class LibvirtTests(LibvirtTestsBase): # type: ignore | ||
| def __init__(self, methodName): | ||
| super().__init__(methodName, controllerVM, computeVM) | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| start_all() | ||
| initialControllerVMSetup(controllerVM, target_os="windows") | ||
| initialComputeVMSetup(computeVM) | ||
|
|
||
| def test_windows_boot(self): | ||
| """ | ||
| Test that we do not introduce a regression with respect to booting windows. | ||
| """ | ||
|
|
||
| controllerVM.succeed( | ||
| "virsh define /etc/domain-windows-server-sapphire-rapids.xml" | ||
| ) | ||
| controllerVM.succeed("virsh start testvm") | ||
| wait_for_ssh(controllerVM, user="administrator", password="FOO99bar!!") | ||
|
|
||
|
|
||
| def suite(): | ||
| # Test cases involving live migration sorted in alphabetical order. | ||
| testcases = [ | ||
| LibvirtTests.test_windows_boot, | ||
| ] | ||
|
|
||
| suite = unittest.TestSuite() | ||
| for testcaseMethod in testcases: | ||
| suite.addTest(LibvirtTests(testcaseMethod.__name__)) | ||
| return suite | ||
|
|
||
|
|
||
| runner = unittest.TextTestRunner() | ||
| if not runner.run(suite()).wasSuccessful(): | ||
| raise Exception("Test Run unsuccessful") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import unittest | ||
|
|
||
| # Following import statement allows for proper python IDE support and proper | ||
| # nix build support. The duplicate listing of imported functions is a bit | ||
| # unfortunate, but it seems to be the best compromise. This way the python IDE | ||
| # support works out of the box in VSCode and IntelliJ without requiring | ||
| # additional IDE configuration. | ||
| try: | ||
| from ..test_helper.test_helper import ( # type: ignore | ||
| LibvirtTestsBase, | ||
| initialComputeVMSetup, | ||
| initialControllerVMSetup, | ||
| wait_for_ssh, | ||
| ) | ||
| except Exception: | ||
| from test_helper import ( | ||
| LibvirtTestsBase, | ||
| initialComputeVMSetup, | ||
| initialControllerVMSetup, | ||
| wait_for_ssh, | ||
| ) | ||
|
|
||
| # pyright: reportPossiblyUnboundVariable=false | ||
|
|
||
| # Following is required to allow proper linting of the python code in IDEs. | ||
| # Because certain functions like start_all() and certain objects like computeVM | ||
| # or other machines are added by Nix, we need to provide certain stub objects | ||
| # in order to allow the IDE to lint the python code successfully. | ||
| if "start_all" not in globals(): | ||
| from ..test_helper.test_helper.nixos_test_stubs import ( # type: ignore | ||
| computeVM, | ||
| controllerVM, | ||
| start_all, | ||
| ) | ||
|
|
||
|
|
||
| class LibvirtTests(LibvirtTestsBase): # type: ignore | ||
| def __init__(self, methodName): | ||
| super().__init__(methodName, controllerVM, computeVM) | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| start_all() | ||
| initialControllerVMSetup(controllerVM, target_os="windows") | ||
| initialComputeVMSetup(computeVM) | ||
|
|
||
| def test_windows_boot(self): | ||
| """ | ||
| Test that we do not introduce a regression with respect to booting windows. | ||
| """ | ||
|
|
||
| controllerVM.succeed("virsh define /etc/domain-windows-server.xml") | ||
| controllerVM.succeed("virsh start testvm") | ||
| wait_for_ssh(controllerVM, user="administrator", password="FOO99bar!!") | ||
|
|
||
|
|
||
| def suite(): | ||
| # Test cases sorted in alphabetical order. | ||
| testcases = [ | ||
| LibvirtTests.test_windows_boot, | ||
| ] | ||
|
|
||
| suite = unittest.TestSuite() | ||
| for testcaseMethod in testcases: | ||
| suite.addTest(LibvirtTests(testcaseMethod.__name__)) | ||
| return suite | ||
|
|
||
|
|
||
| runner = unittest.TextTestRunner() | ||
| if not runner.run(suite()).wasSuccessful(): | ||
| raise Exception("Test Run unsuccessful") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.