Thomas Kosiewski and Ethan Dickson
8fb77c1b94
test(coderd/x/chatd): wait for in-flight admissions before partitioning replica ( #31830 )
...
Fixes the `TestRunnerManager_HeartbeatDoesNotReviveStaleLease` flake
([CODAGT-1288](https://linear.app/codercom/issue/CODAGT-1288 )).
An admission on replica one that started before the simulated partition
could finish after the test made chat A's lease stale, then admit chat B
on replica one. Replica two never acquired B and the test timed out
waiting for it.
`partitionableLimiter` now holds a read lock for each `Admit` call, and
`setPartitioned` takes the write lock. Setting the partition therefore
waits for admissions already in flight, which see A's lease as fresh and
refuse B. This is a test-only change.
Verification:
- With a 1s delay injected into `partitionableLimiter.Admit`, the
original test failed 3/3 with the CI error. The fixed test passed 3/3
with the same delay.
- `go test -race -count=20` passed for this test and the other tests in
the file.
- `golangci-lint` and `go vet` on `./coderd/x/chatd/...` are clean.
> [!NOTE]
> Generated by Coder Agents.
Co-authored-by: Ethan Dickson <ethanndickson@gmail.com >
2026-12-02 06:29:37 +00:00
..
2026-10-19 14:02:46 +11:00
2026-11-24 11:41:03 -05:00
2026-11-18 14:14:27 +11:00
2026-11-18 14:14:27 +11:00
2026-10-27 01:06:49 +01:00
2026-11-24 11:41:03 -05:00
2026-11-19 00:33:46 +11:00
2026-11-18 14:14:27 +11:00
2026-12-01 18:32:54 +02:00
2026-09-28 09:25:01 +00:00
2026-10-27 09:56:02 +00:00
2026-12-01 00:17:20 +11:00
2026-11-24 11:41:03 -05:00
2026-12-01 00:17:20 +11:00
2026-11-25 07:22:44 +01:00
2026-12-01 00:17:20 +11:00
2026-11-25 16:26:23 +02:00
2026-10-26 17:55:48 +01:00
2026-11-03 15:47:54 +00:00
2026-10-26 17:55:52 +01:00
2026-10-26 17:55:52 +01:00
2026-10-26 17:55:52 +01:00
2026-10-26 17:55:52 +01:00
2026-10-22 07:55:42 +00:00
2026-10-22 07:55:42 +00:00
2026-10-29 23:24:18 +01:00
2026-11-13 09:59:39 -07:00
2026-10-01 16:42:51 +02:00
2026-12-02 06:29:37 +00:00
2026-11-13 09:59:39 -07:00
2026-11-25 18:28:55 +02:00
2026-10-20 09:29:57 +00:00
2026-10-01 16:40:24 +02:00
2026-10-30 15:52:22 +02:00
2026-10-01 16:40:24 +02:00
2026-09-30 11:53:57 -05:00
2026-11-13 09:59:39 -07:00
2026-11-13 09:59:39 -07:00
2026-10-20 22:11:25 +00:00
2026-11-04 15:10:20 -06:00
2026-11-24 11:41:03 -05:00
2026-12-01 00:17:20 +11:00
2026-12-01 00:17:20 +11:00
2026-11-11 00:06:40 +11:00
2026-11-09 15:55:17 +11:00
2026-11-23 12:47:45 +02:00
2026-11-11 00:06:40 +11:00
2026-11-11 00:06:40 +11:00
2026-11-06 13:12:49 +11:00
2026-10-29 23:24:18 +01:00
2026-10-29 23:24:18 +01:00
2026-10-27 18:28:16 +00:00
2026-10-27 18:28:16 +00:00
2026-10-27 18:28:16 +00:00
2026-10-21 14:18:12 +00:00
2026-11-13 10:39:16 -05:00
2026-10-19 14:02:47 +11:00
2026-11-23 12:47:45 +02:00
2026-10-14 14:55:29 -07:00
2026-10-14 14:55:29 -07:00
2026-10-13 13:49:12 +02:00
2026-10-29 20:32:56 +01:00
2026-10-22 07:55:42 +00:00
2026-11-24 11:41:03 -05:00
2026-11-13 09:59:39 -07:00
2026-11-13 09:59:39 -07:00
2026-10-27 22:48:18 +00:00
2026-11-23 12:47:45 +02:00
2026-10-12 09:53:45 +11:00
2026-10-29 20:32:56 +01:00
2026-10-12 09:53:45 +11:00
2026-09-26 21:39:40 +02:00
2026-11-11 00:06:41 +11:00
2026-10-23 12:53:40 +11:00
2026-10-23 12:53:40 +11:00
2026-10-11 19:57:49 +02:00
2026-10-11 19:57:49 +02:00
2026-10-19 14:02:47 +11:00
2026-10-29 20:32:56 +01:00
2026-10-29 20:32:56 +01:00
2026-11-11 00:06:40 +11:00
2026-11-11 00:06:40 +11:00
2026-10-19 12:38:17 +00:00
2026-10-27 18:18:41 -04:00
2026-10-27 18:18:41 -04:00
2026-10-27 19:31:51 +00:00
2026-11-02 21:28:22 +11:00
2026-10-29 23:24:18 +01:00
2026-10-29 13:00:05 +01:00
2026-10-29 13:00:05 +01:00
2026-12-01 18:32:54 +02:00
2026-12-01 18:32:54 +02:00
2026-11-24 11:41:03 -05:00
2026-11-24 11:41:03 -05:00
2026-10-29 20:32:56 +01:00
2026-10-29 12:53:50 +00:00
2026-11-23 12:47:45 +02:00
2026-11-23 12:47:45 +02:00
2026-10-27 18:18:41 -04:00
2026-10-27 18:18:41 -04:00
2026-11-24 13:10:36 +02:00
2026-10-21 19:47:50 +07:00
2026-11-23 12:11:44 +00:00
2026-10-30 01:30:11 +00:00
2026-10-30 01:30:11 +00:00
2026-10-27 10:14:11 +01:00
2026-12-01 18:32:54 +02:00
2026-11-25 18:20:18 +11:00
2026-10-29 13:00:05 +01:00
2026-10-27 23:10:37 +00:00
2026-10-27 23:10:37 +00:00
2026-10-01 16:42:51 +02:00
2026-10-27 10:14:19 +01:00
2026-10-30 15:52:22 +02:00
2026-10-29 12:53:50 +00:00
2026-10-29 12:53:50 +00:00
2026-09-30 11:53:58 -05:00
2026-09-30 11:53:58 -05:00
2026-11-23 12:47:45 +02:00
2026-09-28 09:25:01 +00:00
2026-09-28 09:25:01 +00:00
2026-11-13 13:02:38 +02:00
2026-11-13 13:02:38 +02:00
2026-11-13 13:02:38 +02:00
2026-11-25 18:28:55 +02:00
2026-11-25 18:28:55 +02:00
2026-11-25 18:28:55 +02:00
2026-11-25 18:28:55 +02:00
2026-11-13 09:59:39 -07:00
2026-11-13 13:02:38 +02:00
2026-11-13 09:59:39 -07:00
2026-11-02 16:25:40 +11:00
2026-10-19 14:02:46 +11:00
2026-11-09 15:55:17 +11:00
2026-11-09 15:55:17 +11:00
2026-10-27 16:13:00 +01:00
2026-11-09 15:55:17 +11:00
2026-11-13 13:02:38 +02:00
2026-11-13 09:59:39 -07:00
2026-11-13 09:59:39 -07:00
2026-10-27 10:23:01 +01:00
2026-10-27 10:23:01 +01:00
2026-10-27 11:29:10 +11:00
2026-09-24 14:02:06 +10:00
2026-10-15 14:39:21 +11:00
2026-10-27 10:14:11 +01:00
2026-11-12 11:50:42 +01:00
2026-11-12 11:50:42 +01:00
2026-11-13 09:59:39 -07:00
2026-12-01 00:17:20 +11:00
2026-11-13 09:59:39 -07:00
2026-11-24 11:41:03 -05:00
2026-11-24 11:41:03 -05:00
2026-10-01 16:42:51 +02:00
2026-11-13 09:59:39 -07:00