Repository navigation
test(controller): rewrite envtest suite to run a real Manager - #70
Merged
Merged
Conversation
The previous suite started envtest but constructed reconcilers ad-hoc and called Reconcile() once per test. That skipped watches, requeues, finalizers, and field-managed updates — so the four scaffold tests for Project/Branch/Pageserver/Safekeeper were essentially compile checks (none of them set required spec fields, none of them asserted post-reconcile state). Rewrites suite_test.go to start a controller-runtime Manager with all five reconcilers registered, fakes.StorageController wired into Project/Branch via the StorageControllerBaseURL injection, and a goroutine holding mgr.Start. Tests now create CRs through the client and use Eventually(...) to assert observed state — which is what the Manager actually drives. Drops the four scaffold tests (project/branch/pageserver/safekeeper) — they tested nothing the new Manager-based suite doesn't already exercise, and downstream tasks (#9 StatefulSets, #11 webhooks, #12 finalizers, etc.) will write real tests against this foundation. Rewrites cluster_controller_test as the proof of concept: applies a Cluster + its bucket-creds and storcon-db Secrets via fixtures, then Eventually-asserts that the JWT signing Secret, storage-controller Deployment, and storage-broker Deployment all appear — none of which the test itself created. Test takes ~6s end-to-end. internal/controller coverage drops from 45.1% to 16.9% because the previous number was inflated by tests that asserted nothing. The new number reflects actual paths exercised through the cluster reconciler; future tasks restore the rest with real coverage.
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.
No description provided.