This repository was archived by the owner on Aug 5, 2026. It is now read-only.
test: functional coverage for WatchCRDsAndInvalidate + envtest CI - #28
Closed
braghettos wants to merge 1 commit into
Closed
test: functional coverage for WatchCRDsAndInvalidate + envtest CI#28braghettos wants to merge 1 commit into
braghettos wants to merge 1 commit into
Conversation
WatchCRDsAndInvalidate (the RESTMapper discovery-cache refresh) had only a no-op unit test. Add a build-tagged (envtest) functional test that stands up a real apiserver, registers a CRD mid-run, and proves the watched production mapper self-heals with no restart while an unwatched control stays stale until an explicit Reset() (the manual-restart equivalent); plus a resettable-mapper active-setup unit test. Adds a Makefile (test / test-race / test-envtest via setup-envtest) and a test GitHub Actions workflow running both on PR/push to main (the repo had release/security CI but no test job). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se
Collaborator
Author
|
Superseded: the deployed cdc image is built by the core-provider monorepo (go/composition-dynamic-controller); these cache-staleness tests were re-targeted there in core-provider#62. This standalone repo is legacy and being archived. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Functional coverage for
WatchCRDsAndInvalidate— the cdc's discovery-cache staleness fix — which previously had onlyTestWatchCRDsAndInvalidate_NoResetIsNoop.Tests
internal/tools/dynamic/crdwatch_envtest_test.go(-tags envtest) — one real apiserver, two productionNewRESTMappermappers: one guarded byWatchCRDsAndInvalidate, one bare. A CRD is registered mid-run; the watched mapper resolves the new kind on its own within the coalescing window (no restart), while the unwatched control stays stale until an explicitReset()(reproducing the old "restart required" behavior).internal/tools/dynamic/crdwatch_test.go— adds the resettable-mapper active-setup case alongside the existing no-op case.CI
Makefile:test,test-race,test-envtest..github/workflows/test.yaml: runs both on PR/push tomain.Context
Building this envtest layer corrected an earlier misdiagnosis: the umbrella
inst.crdExistsgate renders on a fresh-per-reconcile helm client (proven separately inkrateo-platformops/plumbing), so it is not the stale path. The only long-lived cache is this mapper, whichWatchCRDsAndInvalidatealready keeps fresh — verified live (every cdc controller holds the CRDget;list;watchRBAC). This PR makes that shipped fix properly tested.🤖 Generated with Claude Code
https://claude.ai/code/session_01LJsLqtryCgWwEt8FnPE1se