test: fold near-identical test bodies into tables across eight packages - #29463
Draft
ibetitsmike wants to merge 8 commits into
Draft
ibetitsmike wants to merge 8 commits into
ibetitsmike wants to merge 8 commits into
Conversation
…the matcher tables
…rt tests into tables
…ases into a table
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.
Folds groups of near-identical test bodies (same parent, same parallel flag, differing only in inputs and expected values) into table-driven tests in eight packages:
coderd/templatebuilder,scripts/develop,agent/agentfiles,coderd/x/chatd/chatloop,coderd/x/chatd/chatdebug,enterprise/aibridgeproxyd,cli, andcoderd/database/db2sdk. One commit per package.Every case keeps its previous subtest name,
t.Parallel()placement is unchanged, and the set of=== RUNnames is identical except where standaloneTestX_Yfuncs becameTestX/Ysubtests (chatloop: 9 funcs intoTestExecuteLocalTools_BatchRuntime; chatdebug: 15 funcs into two tables). Members whose bodies differ in more than data stayed as they were (listed per package in the commit messages). Inagent/agentfilesthe fourTestFuzzyReplace_*funcs were already tables, so the shared request plumbing was hoisted into one helper instead of merging the funcs and losing their per-rule docs. Net -1035 lines across 9 test files; runtime is unchanged (all sub-100ms unit tests).Validation
go test -count=1 -tags=testsmallbatch -parallel=8 ./<pkg>/ -run <regex> -vbefore and after, with the=== RUNname sets diffedgo test -race -count=2 -shuffle=onon each converted test: passgolangci-lint run ./<pkg>/...with a fresh cache: 0 issues in all eight packagesPart of the test-suite speedup series (see #29457); independent of the other PRs.
Remote validation
Remote run on a dogfood workspace (separate compute), chat https://dogfood.cdr.dev/agents/5bbe73d0-866a-4841-9cc3-c5e5b4d97e44, tested head
d7c55d6b0e8against base9d973372774: all eight packages pass on the head and under-race -count=3 -shuffle=on; package times are sub-second on both sides (unchanged).=== RUNname sets: chatloop 15 to 16 lines with all nineTestExecuteLocalTools_<X>leaves surviving asTestExecuteLocalTools_BatchRuntime/<X>; chatdebug 42 to 44;aibridgeproxydTestNew32 to 32, byte-identical sorted list. One correction to the text above: seven chatdebug leaves are renamed, not preserved verbatim (TestRecordingTransport_*UnknownLength*becameTestRecordingTransport_UnknownLengthClose/<name without "UnknownLength">), so-runfilters keyed on those old names need updating. Endorsed verdict: PASS.