You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: quic/s2n-quic-tests/README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,11 +126,31 @@ Implement the `s2n_quic_core::packet::interceptor::Interceptor` trait and config
126
126
127
127
```rust
128
128
letclient=Client::builder()
129
-
.with_io(handle.builder().build().unwrap())?
130
-
.with_packet_interceptor(interceptor)?
129
+
.with_io(handle.builder().build().unwrap())?
130
+
.with_event(tracing_events(true, model.clone()))?
131
+
.with_packet_interceptor(interceptor)?
131
132
.start()?;
132
133
```
133
134
135
+
### Blocklist Event Subscriber
136
+
137
+
The test suite includes a `BlocklistSubscriber` utility that can be used to detect and fail tests when specific unwanted events occur. This subscriber works by panicking when it encounters events that have been added to the blocklist, such as certain types of packet losses.
138
+
139
+
To use the blocklist subscriber in tests:
140
+
141
+
```rust
142
+
// Use with a client or server
143
+
letclient=Client::builder()
144
+
.with_io(handle.builder().build().unwrap())?
145
+
.with_tls(certificates::CERT_PEM)?
146
+
.with_event(tracing_events(true, model.clone()))?
147
+
.start()?;
148
+
```
149
+
150
+
When the `with_blocklist` parameter is set to `true`, the `tracing_events` function returns both the standard tracing subscriber and the blocklist subscriber. The standard subscriber logs events as usual, while the blocklist subscriber will cause a test to fail immediately if a blocklisted event is encountered. If certain unwanted events are expected during the test, switching the `with_blocklist` parameter to false to disable the blocklist feature.
151
+
152
+
This is particularly useful for tests that need to verify that certain error conditions don't occur, as the test will fail early with a clear error message rather than continuing with potentially incorrect behavior.
153
+
134
154
### Common Setup
135
155
136
156
`src/lib.rs` provides common utilities for setting up test clients and servers with various configurations.
0 commit comments