Repository navigation
Commit ad9571c
authored
test(server): fix flaky testSynchronousExecutorDoesNotLeakChainEntries (a2aproject#1189)
Two bugs caused intermittent failures:
1. Latch count was taskCount (10) but each task generates TWO push
notifications -> one for the Task event and one for the StatusUpdate
event, both implementing StreamingEventKind -> so the latch could fire
with 10 notifications still in flight. Fixed to taskCount * 2.
2. TOCTOU race between the while-loop exit and assertEquals: with a
synchronous executor, pushTask runs inside compute()'s lambda before
the chain entry is stored, so the latch can reach 0 when count is
transiently 0. The while exited on count==0 but assertEquals re-read
count and could see 1 if the processor stored the entry in between.
Fixed by switching to a do-while that always sleeps before the first
check and asserts on the captured count, not a fresh read.
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>1 parent 09fa265 commit ad9571c
1 file changed
Lines changed: 19 additions & 4 deletions
File tree
- server-common/src/test/java/org/a2aproject/sdk/server/events
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
149 | 158 | | |
150 | | - | |
| 159 | + | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
| |||
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
175 | 189 | | |
176 | | - | |
177 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
178 | 193 | | |
179 | 194 | | |
180 | 195 | | |
| |||
0 commit comments