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

Merged
merged 2 commits into from
Jul 8, 2024

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
@helsaawy helsaawy force-pushed the hcsock-func-tests branch from 0d82a11 to d156cfd Compare May 28, 2024 19:54
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 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 <[email protected]>
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
@helsaawy helsaawy force-pushed the hcsock-func-tests branch from d156cfd to fe99b1f Compare June 19, 2024 17:04
@msscotb msscotb assigned yyatmsft and unassigned anmaxvl Jun 19, 2024
Copy link
Contributor

@yyatmsft yyatmsft left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Hamza El-Saawy <[email protected]>
@helsaawy helsaawy force-pushed the hcsock-func-tests branch from fe99b1f to 19d8435 Compare July 8, 2024 18:10
@helsaawy helsaawy merged commit 376b320 into microsoft:main Jul 8, 2024
19 checks passed
@helsaawy helsaawy deleted the hcsock-func-tests branch July 8, 2024 18:47
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
* [test] Add hvsock connection tests

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 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 <[email protected]>

* PR: remove hvsock feature

Signed-off-by: Hamza El-Saawy <[email protected]>

---------

Signed-off-by: Hamza El-Saawy <[email protected]>
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.

4 participants