test: cache-staleness coverage for helm/v3 + envtest CI - #18
Merged
Conversation
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
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
Test coverage for the
helm/v3discovery-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— coreDeferredDiscoveryRESTMapperstaleness proof: NoMatch → still NoMatch after adding the CRD → maps only afterInvalidate()+Reset().cachedclients_stale_success_test.go— successful-then-stale case (a resolved kind whose CRD is removed): bareInvalidate()is insufficient, onlyReset()recovers; + concurrentReset/RESTMappingunder-race.withcrdinformer_test.go—WithCRDInformersetscachedClients; without it it stays nil;Close()cancels the informer and is idempotent.mappingmiss_retry_test.go—isRESTMappingMissvariants + the reset-picks-up-new-kind contract.Functional (
-tags envtest, real apiserver)crdexists_envtest_test.go— renders the installerinst.crdExistsmechanism against envtest, registers a CRD mid-run, asserts the render sees it without a restart.CI
Makefile:test,test-race,test-envtest(installssetup-envtest, resolves the control-plane assets)..github/workflows/test.yaml:make test-race+make test-envteston PR/push tomain.All green locally (unit under
-race; envtest against k8s 1.36.0).🤖 Generated with Claude Code
https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se