controller/network: add unit tests for network controller#2647
Open
shreyanshjain7174 wants to merge 3 commits intomicrosoft:mainfrom
Open
controller/network: add unit tests for network controller#2647shreyanshjain7174 wants to merge 3 commits intomicrosoft:mainfrom
shreyanshjain7174 wants to merge 3 commits intomicrosoft:mainfrom
Conversation
This change adds the network controller implementation for V2 shims which manages the network lifecycle for a single pod running inside a UVM. Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
15 tests covering teardown cleanup chains (partial NIC failure continues, failed NICs stay tracked for retry from Invalid state), state machine transitions (idempotent teardown, no-op on unconfigured, duplicate Setup rejected), LCOW endpoint add/remove operations (host-before-guest ordering via InOrder, BuildLCOWNetworkAdapter struct verification, guest-fail still tracked for cleanup, host-fail not tracked), nil-capabilities disabling guest ops, and State.String(). Mocks generated for vmNetworkManager, linuxGuestNetworkManager, and capabilitiesProvider. GCS GuestDefinedCapabilities mock reused from internal/gcs/mock/. Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #2633 — must merge first.
Adds unit tests for the network controller (
internal/controller/network/). 22 tests across LCOW and WCOW, biased toward resource cleanup chains and state corruption rather than guard-check permutations.Teardown: continue-on-error when one NIC removal fails (remaining NICs still attempted, failed NICs stay tracked for retry), retry from Invalid state, idempotent when TornDown, no-op when NotConfigured, full Configured→TornDown lifecycle. Setup rejects duplicate calls.
LCOW endpoint ops: host AddNIC before guest AddLCOWNetworkInterface (ordering enforced via
gomock.InOrder),BuildLCOWNetworkAdapterstruct verified, host-fail→not tracked, guest-fail→still tracked for Teardown cleanup, guest-remove-fails→host RemoveNIC not called, nil capabilities disables guest ops.WCOW endpoint ops: 3-phase add (PreAdd → host AddNIC → guest Add), PreAdd failure→not tracked, guest-finalize failure→still tracked, remove ordering (guest before host), namespace add with/without guest support.
Mocks generated for
vmNetworkManager,linuxGuestNetworkManager,windowsGuestNetworkManager, andcapabilitiesProvider.GuestDefinedCapabilitiesmock reused frominternal/gcs/mock/.