mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: standardize on *_internal_test.go for white-box tests (#25601)
My agent added `//nolint:testpackage` to a test file on one of my PRs. Again. This PR cleans it up across the entire repo and updates the in-repo conventions so future agents stop doing it. The repo already has a precedent for white-box tests that need to touch unexported symbols: `*_internal_test.go` (145+ existing files). The `testpackage` linter's default `skip-regexp` exempts that filename suffix, so the `//nolint:testpackage` directive is unnecessary in every case where someone reached for it. This PR renames 51 such files to `*_internal_test.go` via `git mv` so blame and history follow, and strips the dead directive from 2 files that were already correctly named (`coderd/oauth2provider/authorize_internal_test.go`, `coderd/x/chatd/advisor_internal_test.go`). `.claude/docs/TESTING.md` now documents the rule explicitly under *Test Package Naming*, which is imported into the root `AGENTS.md` via `@.claude/docs/TESTING.md`. The rule: prefer `package foo_test`; if you need internal access, rename the file to `*_internal_test.go` rather than adding a nolint directive.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
//nolint:testpackage // Internal test for unexported hashOAuth2State helper.
|
||||
package oauth2provider
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package coderd //nolint:testpackage // Tests the unexported resolveTemplateMetaUpdate helper.
|
||||
package coderd
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Accesses unexported advisor helpers.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatdebug //nolint:testpackage // Checks unexported normalized structs against fantasy source types.
|
||||
package chatdebug
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatdebug //nolint:testpackage // Uses unexported normalization helpers.
|
||||
package chatdebug
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatdebug //nolint:testpackage // Uses unexported recorder helpers.
|
||||
package chatdebug
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatdebug //nolint:testpackage // Uses unexported recorder helpers.
|
||||
package chatdebug
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatdebug //nolint:testpackage // Uses unexported recorder helpers.
|
||||
package chatdebug
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatloop //nolint:testpackage // Uses internal symbols.
|
||||
package chatloop
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatloop //nolint:testpackage // Uses internal symbols.
|
||||
package chatloop
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chattool //nolint:testpackage // Uses internal symbols.
|
||||
package chattool
|
||||
|
||||
import (
|
||||
"testing"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chattool //nolint:testpackage // Uses internal symbols.
|
||||
package chattool
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Uses internal cache state.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Uses internal symbols.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Uses internal symbols.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Keeps internal helper tests in-package.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Tests internal title override helpers.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package chatd //nolint:testpackage // Keeps chatd unit tests in the package.
|
||||
package chatd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
Reference in New Issue
Block a user