Commit 58ff6d8
committed
Test(reverseproxy): fix flaky finisher test race under -race
TestReverseProxy_Finisher_{Allow,Deny} read finisherStub.seen immediately
after http.Get returned. The reverse proxy sets FlushInterval=-1, so the
streamed response reaches the client before the handler's deferred
RunFinish (which dispatches OnFinish) executes — a pre-existing race that
flaked CI under -race (~1 in 20 locally).
Poll for the expected finishers with a short timeout (waitSeen) instead of
reading once, and store finisherStub.seen LAST in OnFinish (after outcome)
so observing seen==true guarantees outcome is visible. The negative check
(after-deny must NOT fire) runs after the positive waits, by which point
the single RunFinish dispatch is complete.
Verified: 50× -race runs of the finisher tests and the full authlib -race
suite are green.
Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Hai Huang <huang195@gmail.com>1 parent 2eb3eb1 commit 58ff6d8
1 file changed
Lines changed: 25 additions & 4 deletions
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
14 | 30 | | |
15 | 31 | | |
16 | 32 | | |
| |||
34 | 50 | | |
35 | 51 | | |
36 | 52 | | |
37 | | - | |
38 | 53 | | |
39 | 54 | | |
40 | 55 | | |
41 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
42 | 60 | | |
43 | 61 | | |
44 | 62 | | |
| |||
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
76 | | - | |
| 94 | + | |
77 | 95 | | |
78 | 96 | | |
79 | 97 | | |
| |||
133 | 151 | | |
134 | 152 | | |
135 | 153 | | |
136 | | - | |
| 154 | + | |
137 | 155 | | |
138 | 156 | | |
139 | | - | |
| 157 | + | |
140 | 158 | | |
141 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
142 | 163 | | |
143 | 164 | | |
144 | 165 | | |
| |||
0 commit comments