controller/network: add unit tests for LCOW network controller#10
Closed
shreyanshjain7174 wants to merge 1 commit intorawahars:network-controllerfrom
Closed
controller/network: add unit tests for LCOW network controller#10shreyanshjain7174 wants to merge 1 commit intorawahars:network-controllerfrom
shreyanshjain7174 wants to merge 1 commit intorawahars:network-controllerfrom
Conversation
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.
Stacked on microsoft#2633.
Adds 15 unit tests for the LCOW network controller (
internal/controller/network/). Tests target production failure paths — resource cleanup chains, state corruption, and partially-torn-down NICs.Teardown tests: continue-on-error when one NIC removal fails (remaining NICs still attempted, failed NICs stay tracked for retry), retry from Invalid state cleans up remaining endpoints, idempotent when already TornDown, no-op when NotConfigured, full Configured→TornDown lifecycle. Setup guard rejects duplicate calls.
LCOW endpoint tests: host AddNIC before guest AddLCOWNetworkInterface (ordering enforced via
gomock.InOrder),BuildLCOWNetworkAdapterstruct verified against expected output, host-succeeds-guest-fails keeps NIC tracked for Teardown cleanup, host-AddNIC-fails does not track NIC, guest-remove-fails prevents host RemoveNIC call, nil capabilities disables guest-side ops.Mocks generated for
vmNetworkManager,linuxGuestNetworkManager, andcapabilitiesProvider.GuestDefinedCapabilitiesmock reused frominternal/gcs/mock/.