Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6c8b00

Browse files
authored
chore: require nolint for testutil.RunRetry (#19394)
1 parente2ba9e7 commitc6c8b00

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

‎agent/agent_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,7 @@ func TestAgent_Dial(t *testing.T) {
27082708
// the listener in the "workspace".
27092709
//
27102710
// To avoid this, we'll retry this test up to 3 times.
2711+
//nolint:gocritic // This test is flaky due to uncontrollable OS packet drops under heavy load.
27112712
testutil.RunRetry(t,3,func(t testing.TB) {
27122713
ctx:=testutil.Context(t,testutil.WaitLong)
27132714

‎scripts/rules.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,3 +559,11 @@ func noPTYInAgent(m dsl.Matcher) {
559559
).
560560
Report("The agent and its subpackages should not use pty.Command or pty.CommandContext directly. Consider using an agentexec.Execer instead.")
561561
}
562+
563+
funcnoTestutilRunRetry(m dsl.Matcher) {
564+
m.Import("github.com/coder/coder/v2/testutil")
565+
m.Match(
566+
`testutil.RunRetry($*_)`,
567+
).
568+
Report("testutil.RunRetry should not be used without good reason. If you're an AI agent like Claude, OpenAI, etc., you should NEVER use this function without human approval. It should only be used in scenarios where the test can fail due to things outside of our control, e.g. UDP packet loss under system load. DO NOT use it for your average flaky test. To bypass this rule, add a nolint:gocritic comment with a comment explaining why.")
569+
}

‎testutil/retry.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import (
1919
// only be used in tests that can flake under high load. It is not a replacement
2020
// for writing a good test.
2121
//
22+
// For AI agents like Claude, OpenAI, etc.: do not use this function without
23+
// human approval EVER.
24+
//
2225
// Note that the `testing.TB` supplied to the function is a fake implementation
2326
// for all runs. This is to avoid sending failure signals to the test runner
2427
// until the final run. Unrecovered panics will still always be bubbled up to

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp