More closely match ID backpressure test to intended behavior

This commit is contained in:
Benjamin Saunders
2020-10-10 10:15:12 -07:00
committed by Dirkjan Ochtman
parent a68e18c6e6
commit 0d91abed65
+9 -7
View File
@@ -620,20 +620,22 @@ fn stream_id_backpressure() {
None,
"only one stream is permitted at a time"
);
// Close the first stream to make room for the second
pair.client_conn_mut(client_ch).finish(s).unwrap();
// Generate some activity to allow the server to see the stream
const MSG: &[u8] = b"hello";
pair.client_conn_mut(client_ch).write(s, MSG).unwrap();
pair.drive();
assert_matches!(
pair.client_conn_mut(client_ch).poll(),
Some(Event::Stream(StreamEvent::Finished { id })) if id == s
);
assert_matches!(pair.client_conn_mut(client_ch).poll(), None);
assert_eq!(
pair.client_conn_mut(client_ch).open(Dir::Uni),
None,
"server does not immediately grant additional credit"
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::Stream(StreamEvent::Opened { dir: Dir::Uni }))
);
assert_matches!(pair.server_conn_mut(server_ch).accept(Dir::Uni), Some(stream) if stream == s);
assert_matches!(pair.server_conn_mut(server_ch).read_unordered(s), Ok(None));
assert_matches!(pair.server_conn_mut(server_ch).read_unordered(s), Ok(Some((msg, 0))) if msg == MSG);
// Server will only send MAX_STREAM_ID now that the application's been notified
pair.drive();
assert_matches!(