Skip to content

Commit a26879d

Browse files
authored
tests: properly match http3 error variants (#2721)
* properly match error variants * pin ci version of tracing-core
1 parent 65102c9 commit a26879d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ jobs:
318318
cargo update -p hashbrown --precise 0.15.0
319319
cargo update -p native-tls --precise 0.2.13
320320
cargo update -p once_cell --precise 1.20.3
321+
cargo update -p tracing-core --precise 0.1.33
321322
322323
- uses: Swatinem/rust-cache@v2
323324

tests/http3.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async fn http3_test_concurrent_request() {
158158
async fn http3_test_reconnection() {
159159
use std::error::Error;
160160

161-
use h3::error::StreamError;
161+
use h3::error::{ConnectionError, StreamError};
162162

163163
let server = server::Http3::new().build(|_| async { http::Response::default() });
164164
let addr = server.addr();
@@ -197,8 +197,13 @@ async fn http3_test_reconnection() {
197197
.downcast_ref::<StreamError>()
198198
.unwrap();
199199

200-
// Why is it so hard to inspect h3 errors? :/
201-
assert!(err.to_string().contains("Timeout"));
200+
assert!(matches!(
201+
err,
202+
StreamError::ConnectionError {
203+
0: ConnectionError::Timeout { .. },
204+
..
205+
}
206+
));
202207

203208
let server = server::Http3::new()
204209
.with_addr(addr)

0 commit comments

Comments
 (0)