perf(tests): stub managed-dolt store openers in preflight tests#2077
Open
hexsprite wants to merge 4 commits into
Open
perf(tests): stub managed-dolt store openers in preflight tests#2077hexsprite wants to merge 4 commits into
hexsprite wants to merge 4 commits into
Conversation
`gc prompt` and `gc prompt synth` were added to the CLI without regenerating docs/reference/cli.md from cmd/genschema. The pre-commit hook auto-regenerates this file when staged Go changes touch CLI definitions, so the drift surfaced on an unrelated PR's commit. Run: `go run ./cmd/genschema`
Adds TestCLIDocsFreshness, which walks the live cobra tree and asserts every non-hidden command has a heading in docs/reference/cli.md. The prior pre-commit hook silently regenerated cli.md and stapled it to whichever commit happened to touch Go files, so CLI drift leaked onto unrelated PRs. This catches the drift in CI/pre-commit and points at the right fix: go run ./cmd/genschema. Structural rather than byte-equal — cobra registers `completion`/`help` only on Execute, which the in-test render path skips.
Two tests build CityRuntime directly, skipping newTestCityRuntime. ensureManagedDoltPublishedForRuntime spawns real dolt sql-server at construction/tick even with stub callbacks, leaving orphaned children. Add cleanupManagedDoltTestCity(t, cityPath) for both tests. Refs hq-bgb3v
The managed-dolt preflight ordering tests spawned a real dolt sql-server per test (~12s each) via newControllerState's openCityStoreAt call and newCityRuntime's sweep store open. With three tests on the hot path this cost ~38s of wall time for behavior that only verifies ordering and never needs a live store. Add two test-overridable package vars (newControllerStateOpenCityStore, newCityRuntimeOpenSweepStore) and a stubManagedDoltStoreOpeners(t) helper that swaps in fresh in-memory stores. Restored via t.Cleanup. Result: 4 target tests drop from ~50s -> ~1s aggregate. Full cmd/gc suite still green (677 tests). Closes hq-wvcvb.
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.
Summary
Stacked on #2069 — depends on the preflight ordering tests added there. Merge #2069 first.
The four managed-dolt preflight ordering tests in cmd/gc/city_runtime_test.go spawn a real dolt sql-server per test (~12s each) because newControllerState → openCityStoreAt and newCityRuntime → sweep store both open a live bd-backed store. Cost: ~38s of wall time for three tests that only verify call ordering.
This change:
Result
4-test aggregate: 50.5s → 0.96s.
Full cmd/gc suite (677 tests) still passes.
Closes hq-wvcvb.
Test plan