Skip to content

test: add Network and NetworkContext lifecycle e2e tests#236

Closed
ecv wants to merge 5 commits into
mainfrom
test/migrate-network-crud-from-infra
Closed

test: add Network and NetworkContext lifecycle e2e tests#236
ecv wants to merge 5 commits into
mainfrom
test/migrate-network-crud-from-infra

Conversation

@ecv

@ecv ecv commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Adds local kind-harness e2e coverage for two NSO-owned reconcile paths that had none:

  • test/e2e/network-crud — bare Network lifecycle: admission, the networking.datumapis.com/network-controller finalizer, and clean deletion (finalizer release with no children to garbage-collect).
  • test/e2e/network-context-lifecycleNetworkContext readiness and cascade delete: it builds the Network, NetworkBinding, and NetworkContext chain, drives the context Programmed, asserts the controller derives Ready, asserts the NetworkBinding then reaches Ready, then deletes the Network and asserts its finalizer cascade-deletes the owned NetworkContext before releasing.

Why

network-crud guards CRD/webhook/finalizer wiring. network-context-lifecycle guards the two behaviors most likely to regress silently: the Programmed to Ready transition and the finalizer's owned-child garbage collection.

Coverage boundary

Readiness in this stack is provider-driven — NetworkContext.Ready follows NetworkContext.Programmed, and NSO never sets Programmed; an external plugin does. No provider runs in the local harness, so:

  • network-crud does not assert a bare Network reaches Ready (nothing local can make that true).
  • network-context-lifecycle patches Programmed directly to stand in for the plugin (mirroring networkbinding/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 Programmed signal.

Verification

CI e2e (kind) and task dev:test locally. Both tests pass; behavior confirmed in CI — the NetworkContext reconciles to Ready once Programmed is set, the ownerReference back to the Network is present, and deleting the Network cascades to the context.

@ecv

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
ecv force-pushed the test/migrate-network-crud-from-infra branch from 7995bb1 to 36d14d7 Compare July 13, 2026 20:38
ecv added 4 commits July 13, 2026 18:00
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 ecv changed the title test: migrate network-crud e2e from infra test: add e2e coverage for Network and NetworkContext lifecycle Jul 13, 2026
@ecv
ecv marked this pull request as ready for review July 13, 2026 23:07
@ecv ecv changed the title test: add e2e coverage for Network and NetworkContext lifecycle test: add Network and NetworkContext lifecycle e2e tests Jul 13, 2026
@ecv
ecv enabled auto-merge July 13, 2026 23:16
@ecv
ecv requested review from kevwilliams and scotwells July 13, 2026 23:16
@ecv

ecv commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #281 — the same two tests rebased onto current main. This branch was 57 commits behind and its green checks predate the prod-fidelity env (#276), so #281 re-runs them against the current task test-infra:test-e2e two-cluster env. Closing in favor of #281.

@ecv ecv closed this Jul 15, 2026
auto-merge was automatically disabled July 15, 2026 02:20

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant