8119942d
test: the QUIC pump waits for the marker it is about to assert on
a73x 2026-09-03 19:25
Commit message
src/server/server_test_quic.zig
| Old | New | ||
|---|---|---|---|
| @@ -307,11 +307,22 @@ test "Server: one QUIC client leaving does not disturb the other" { | |||
| 307 | b.drain(); | 307 | b.drain(); |
| 308 | var replica = try Engine.init(alloc, .{ .cols = 80, .rows = 24 }); | 308 | var replica = try Engine.init(alloc, .{ .cols = 80, .rows = 24 }); |
| 309 | defer replica.deinit(); | 309 | defer replica.deinit(); |
| 310 | try quicPump(&td.srv, &both, 15000, &b, struct { | 310 | // The predicate has to be the ASSERTION, not a weaker relative of it: |
| 311 | fn f(t: *quic_server.TestPeer) bool { | 311 | // `echoed()` counts every byte B has ever taken, and B took a snapshot |
| 312 | return t.echoed() > 0 and findFrame(t.cl.in.items, .delta) != null; | 312 | // long before this marker, so "more than zero, and some delta has |
| 313 | // arrived" was already true the moment the pump started. It returned at | ||
| 314 | // once and the assertion below then graded bytes from earlier in the | ||
| 315 | // test. On Linux the delta happened to be late enough that the pump | ||
| 316 | // waited anyway; on the Mac it was not, and the test failed. | ||
| 317 | const Grew = struct { | ||
| 318 | peer: *quic_server.TestPeer, | ||
| 319 | was: usize, | ||
| 320 | fn f(self: *@This()) bool { | ||
| 321 | return self.peer.echoed() > self.was; | ||
| 313 | } | 322 | } |
| 314 | }.f); | 323 | }; |
| 324 | var grew: Grew = .{ .peer = &b, .was = before }; | ||
| 325 | try quicPump(&td.srv, &both, 15000, &grew, Grew.f); | ||
| 315 | try std.testing.expect(b.echoed() > before); | 326 | try std.testing.expect(b.echoed() > before); |
| 316 | } | 327 | } |
| 317 | 328 | ||