test: add Network and NetworkContext lifecycle e2e tests#236
Closed
ecv wants to merge 5 commits into
Closed
Conversation
This comment has been minimized.
This comment has been minimized.
Migrate the Network CRUD API-contract test out of datum/infra's live-env Chainsaw suite into NSO's local kind harness, per datum-cloud/infra#3006. This test validates a networking.datumapis.com contract owned by NSO, so it belongs in this repo and runs against the local operator pre-merge. Key changes: - Drop the datumctl auth update-kubeconfig setup step and the clusters/cluster: project blocks that targeted ./test-kubeconfig; the test now runs on spec.cluster: nso-standard like the sibling tests. - Remove spec.skip: true; the live blockers in #2733 don't apply to the local operator. - Keep the Network resource body, the Ready assertion (2m timeout), and the delete step intact.
ecv
force-pushed
the
test/migrate-network-crud-from-infra
branch
from
July 13, 2026 20:38
7995bb1 to
36d14d7
Compare
No e2e covers the bare Network contract NSO owns. Add one that exercises admission and the finalizer lifecycle in the local kind harness. Key changes: - assert Network admission and the network-controller finalizer - assert clean deletion (finalizer release, no NetworkContext GC) - use chainsaw's native delete op Readiness is intentionally not asserted: NSO writes no condition on a bare Network; readiness is provider-driven and no provider runs in the local harness.
Two NSO behaviors have no e2e coverage in the local kind harness: the networkcontext controller deriving Ready from Programmed, and the Network finalizer garbage-collecting an owned NetworkContext on delete. Add a test that drives both. Key changes: - build the Network -> NetworkBinding -> NetworkContext chain - patch the context Programmed and assert the controller sets Ready - assert the NetworkBinding then reaches Ready - delete the Network and assert the owned context is cascade-deleted before the finalizer releases A plugin normally sets Programmed; none runs locally, so the condition is patched directly, mirroring the networkbinding test.
The first CI run failed on two test-authoring bugs, not operator behavior. Key changes: - network-crud: use a fixed Network name; create outputs do not propagate across steps, so $NETWORK_NAME was undefined in the assert - network-crud: assert the finalizer via array containment instead of a JMESPath contains() expression - network-context-lifecycle: assert Ready via array containment; the filter projection conditions[?type=='Ready'][0].status is not indexable and errored with "types are not comparable, string - slice"
Chainsaw array assertions are length-strict, not containment: asserting a single condition against a status that holds both Programmed and Ready failed with "lengths of slices don't match". Assert via a length() filter instead, matching the ownerReferences assertion in the same test.
ecv
marked this pull request as ready for review
July 13, 2026 23:07
ecv
enabled auto-merge
July 13, 2026 23:16
Contributor
Author
auto-merge was automatically disabled
July 15, 2026 02:20
Pull request was closed
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.
What
Adds local kind-harness e2e coverage for two NSO-owned reconcile paths that had none:
test/e2e/network-crud— bareNetworklifecycle: admission, thenetworking.datumapis.com/network-controllerfinalizer, and clean deletion (finalizer release with no children to garbage-collect).test/e2e/network-context-lifecycle—NetworkContextreadiness and cascade delete: it builds theNetwork,NetworkBinding, andNetworkContextchain, drives the contextProgrammed, asserts the controller derivesReady, asserts theNetworkBindingthen reachesReady, then deletes theNetworkand asserts its finalizer cascade-deletes the ownedNetworkContextbefore releasing.Why
network-crudguards CRD/webhook/finalizer wiring.network-context-lifecycleguards the two behaviors most likely to regress silently: theProgrammedtoReadytransition and the finalizer's owned-child garbage collection.Coverage boundary
Readiness in this stack is provider-driven —
NetworkContext.ReadyfollowsNetworkContext.Programmed, and NSO never setsProgrammed; an external plugin does. No provider runs in the local harness, so:network-cruddoes not assert a bareNetworkreachesReady(nothing local can make that true).network-context-lifecyclepatchesProgrammeddirectly to stand in for the plugin (mirroringnetworkbinding/ready-when-context-is-ready), then asserts the operator-owned consequences.Out of scope (needs a real provider): actual IPAM allocation and a genuine backend
Programmedsignal.Verification
CI e2e (kind) and
task dev:testlocally. Both tests pass; behavior confirmed in CI — theNetworkContextreconciles toReadyonceProgrammedis set, the ownerReference back to theNetworkis present, and deleting theNetworkcascades to the context.