Skip to content

Commit 263267b

Browse files
Nishad DeokarNishad Deokar
authored andcommitted
Assert the exact round-robin order in the starvation test
Flush each stream individually so the order streams enter the rotation is fixed rather than dependent on Set iteration order, letting the test assert the served sequence exactly.
1 parent e61464b commit 263267b

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Tests/NIOHTTP2Tests/OutboundFlowControlBufferTests.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,11 @@ class OutboundFlowControlBufferTests: XCTestCase {
402402
self.buffer.streamCreated(streamID, initialWindowSize: 15)
403403
let frame = self.createDataFrame(streamID, byteBufferSize: 15)
404404
XCTAssertNoThrow(try self.buffer.processOutboundFrame(frame, promise: nil).assertNothing())
405+
self.buffer.flushReceived()
405406
}
406-
self.buffer.flushReceived()
407-
408-
let served = self.receivedFrames().map { $0.streamID }
409407

410408
// Every stream must be served once per round so that none can be starved.
411-
let firstRound = Array(served.prefix(streamIDs.count))
412-
XCTAssertEqual(Set(firstRound), Set(streamIDs))
413-
XCTAssertEqual(served, firstRound + firstRound + firstRound)
409+
XCTAssertEqual(self.receivedFrames().map { $0.streamID }, [1, 3, 5, 1, 3, 5, 1, 3, 5])
414410
}
415411

416412
func testRejectsPrioritySelfDependency() {

0 commit comments

Comments
 (0)