Skip to content
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

[test] Add Hyper-V socket functional tests #1979

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

helsaawy
Copy link
Contributor

@helsaawy helsaawy commented Dec 7, 2023

Add tests for binding to and listening on hyper-v sockets from within a uVM (as well as a hyper-v isolated containers).

Tests verify default SDDL and wildcard bind settings, as well updating the settings for a particular service ID.

In order to test HVSocket communication, an agent is needed to run from within the uVM (or container within that).
To accomplish that, the ability to re-exec the (functional) testing binary is added, so that it can be shared into the uVM (or container) and then run a separate code path that is defined within the same test case that is running on the host.

For example, while running the test case TestHVSock_Container_GuestBind/default, the functional testing binary
that is being run (i.e. functional.test.exe) is shared within the running container and then run with the flag -run=^TestHVSock_Container_GuestBind$/^default$.
This causes the alternative code path defined in TestHVSock_Container_GuestBind/default test case to run in the guest, which binds to the agreed-upon service GUID, and then (after the host connects to the same service GUID) verifies the expected VM and service GUIDs, and then ensures communication is possible.

@helsaawy helsaawy added the tests Pull requests that modify tests label Dec 7, 2023
@helsaawy helsaawy force-pushed the hcsock-func-tests branch 3 times, most recently from d68cb40 to 0d82a11 Compare December 12, 2023 20:57
@helsaawy helsaawy changed the title Add Hyper-V socket functional tests [test] Add Hyper-V socket functional tests Feb 8, 2024
Add tests for binding to and listening on hyper-v sockets from within a
uVM (as well as a hyper-v isolated containerd).
Tests verify default SDDL and wildcard bind settings, as well updating
the settings for a particular service ID.

In order to test HVSocket communication, an agent is needed to run from
within the uVM (or container within that).
To accomplish that, the ability to re-exec the (functional) testing
binary is added, so that it can be shared into the uVM (or container)
and then run a separate code path that is defined within the same test
case that is running on the host.

For example, while running the test case
`TestHVSock_Container_GuestBind/default`, the functional testing binary
that is being run (i.e. `functional.test.exe`) is shared within the
running container and then run with the flag
`-run=^TestHVSock_Container_GuestBind$/^default$`. This causes the guest
to bind to the agreed-upon Service GUID, and then (after the host
connects to the same Service GUID), the guest verifies the expected VM
and service GUIDs, and then ensures communication is possible.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its best to review this after disabling showing whitespace (gear icon > "Hide whitespace" check box"), since most of the changes are indentation.

@helsaawy helsaawy marked this pull request as ready for review May 28, 2024 20:04
@helsaawy helsaawy requested a review from a team as a code owner May 28, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Pull requests that modify tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants