Expect errors when opening 2nd stream due to connection limit (#31706)

This commit is contained in:
Lijun Wang 2023-05-19 08:24:52 -07:00 committed by GitHub
parent e6d490708a
commit a8e2b82e38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -1232,7 +1232,16 @@ pub mod test {
let conn1 = make_client_endpoint(&server_address, None).await;
let conn2 = make_client_endpoint(&server_address, None).await;
let mut s1 = conn1.open_uni().await.unwrap();
let mut s2 = conn2.open_uni().await.unwrap();
let s2 = conn2.open_uni().await;
if s2.is_err() {
// It has been noticed if there is already connection open against the server, this open_uni can fail
// with ApplicationClosed(ApplicationClose) error due to CONNECTION_CLOSE_CODE_TOO_MANY before writing to
// the stream -- expect it.
let s2 = s2.err().unwrap();
assert!(matches!(s2, quinn::ConnectionError::ApplicationClosed(_)));
return;
}
let mut s2 = s2.unwrap();
s1.write_all(&[0u8]).await.unwrap();
s1.finish().await.unwrap();
// Send enough data to create more than 1 chunks.