Skip to content

test: cache-staleness coverage for helm/v3 + envtest CI - #18

Merged
braghettos merged 2 commits into
mainfrom
test/cache-staleness-envtest
Aug 5, 2026
Merged

test: cache-staleness coverage for helm/v3 + envtest CI#18
braghettos merged 2 commits into
mainfrom
test/cache-staleness-envtest

Conversation

@braghettos

Copy link
Copy Markdown
Collaborator

What

Test coverage for the helm/v3 discovery-cache invalidation surface, plus CI to run it.

Unit (default suite)

  • crdinformer_edge_test.go — CRD informer edges: unchanged-spec update ⇒ no Reset; changed-spec ⇒ Reset; nil invalidator/client no-op; rapid-add churn; ctx-cancel; logger message.
  • cachedclients_staleness_test.go — core DeferredDiscoveryRESTMapper staleness proof: NoMatch → still NoMatch after adding the CRD → maps only after Invalidate()+Reset().
  • cachedclients_stale_success_test.go — successful-then-stale case (a resolved kind whose CRD is removed): bare Invalidate() is insufficient, only Reset() recovers; + concurrent Reset/RESTMapping under -race.
  • withcrdinformer_test.goWithCRDInformer sets cachedClients; without it it stays nil; Close() cancels the informer and is idempotent.
  • mappingmiss_retry_test.goisRESTMappingMiss variants + the reset-picks-up-new-kind contract.

Functional (-tags envtest, real apiserver)

  • crdexists_envtest_test.go — renders the installer inst.crdExists mechanism against envtest, registers a CRD mid-run, asserts the render sees it without a restart.

CI

  • Makefile: test, test-race, test-envtest (installs setup-envtest, resolves the control-plane assets).
  • .github/workflows/test.yaml: make test-race + make test-envtest on PR/push to main.

All green locally (unit under -race; envtest against k8s 1.36.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se

braghettos and others added 2 commits August 5, 2026 08:23
Unit tests for the helm/v3 discovery-cache invalidation primitives: CRD
informer edge cases (unchanged-spec => no Reset, changed-spec => Reset, nil
invalidator/client no-op, rapid-add churn, ctx-cancel, logger message); the
DeferredDiscoveryRESTMapper staleness proof (NoMatch until Invalidate+Reset)
including the successful-then-stale case where a bare Invalidate is insufficient
and only Reset recovers; WithCRDInformer wiring + idempotent Close; and the
Install mapping-miss reset-then-retry contract.

Plus a build-tagged (envtest) functional test that renders the installer's
inst.crdExists mechanism against a real apiserver, registers a CRD mid-run, and
proves the render picks it up without a client restart.

Adds a Makefile (test / test-race / test-envtest via setup-envtest) and a test
GitHub Actions workflow running both on PR/push to main.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se
`make test-envtest` installed setup-envtest@latest, which is now v0.24.x and requires go >= 1.26;
under this module's go 1.25 toolchain (GOTOOLCHAIN=local) it failed the envtest CI job with
"requires go >= 1.26.0". Pin to @release-0.22, matching sigs.k8s.io/controller-runtime v0.22.3 in
go.mod. Verified: installs cleanly under go 1.25.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se
@braghettos
braghettos merged commit e1ac541 into main Aug 5, 2026
1 check passed
@braghettos
braghettos deleted the test/cache-staleness-envtest branch August 5, 2026 18:08
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