Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MEGE] h3i: implement expected frames #1890

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanrittenhouse
Copy link
Contributor

Expected frames allow the user to specify a list of frames that the h3i client expects to receive over a given connection.

If h3i sees all of the exected frames over the course of the connection, it will pre-emptively close the connection with a CONNECTION_CLOSE frame. If h3i does not see all of the expected frames, the resulting ConnectionSummary will contain a list of the missing target frames for future inspection.

This gives users a way to close tests out without waiting for the idle timeout, or adding Wait/ConnectionClose actions to the end of each test. This should vastly speed up test suites that have a large number of h3i tests.

In the absence of full-fledged integration tests, I modified the content_length_mismatch example to expect a 400, and remove the existing Wait/CC actions:

-        Action::Wait {
-            wait_type: WaitType::StreamEvent(StreamEvent {
-                stream_id: STREAM_ID,
-                event_type: StreamEventType::Headers,
-            }),
-        },
-        Action::ConnectionClose {
-            error: quiche::ConnectionError {
-                is_app: true,
-                error_code: quiche::h3::WireErrorCode::NoError as u64,
-                reason: vec![],
-            },
-        },
     ];
 
-    let summary =
-        sync_client::connect(config, &actions, None).expect("connection failed");
+    let summary = sync_client::connect(
+        config,
+        &actions,
+        Some(vec![ExpectedFrame::new(
+            0,
+            vec![quiche::h3::Header::new(b":status", b"400")].into(),
+        )]),
+    )
+    .expect("connection failed");

Taking a PCAP:
Screenshot 2024-12-19 at 10 27 50 AM

You can see that the client instantly sends the CC frame upon receiving the headers frame, without us needing to specify the action.

@evanrittenhouse evanrittenhouse requested a review from a team as a code owner December 19, 2024 18:28
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/target-frame branch 6 times, most recently from 54874db to e0ff2ba Compare December 20, 2024 00:00
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/target-frame branch from e0ff2ba to 8ac9f2c Compare December 20, 2024 19:08
h3i/src/client/connection_summary.rs Outdated Show resolved Hide resolved
h3i/src/client/connection_summary.rs Outdated Show resolved Hide resolved
h3i/src/client/connection_summary.rs Outdated Show resolved Hide resolved
h3i/src/client/connection_summary.rs Show resolved Hide resolved
h3i/src/client/connection_summary.rs Outdated Show resolved Hide resolved
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/target-frame branch 3 times, most recently from e4dbd46 to f6f9be3 Compare December 20, 2024 20:16
@evanrittenhouse evanrittenhouse changed the title h3i: implement expected frames [DO NOT MEGE] h3i: implement expected frames Dec 20, 2024
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/target-frame branch 2 times, most recently from f3b5196 to 545f564 Compare December 21, 2024 07:27
Expected frames allow the user to specify a list of frames that the h3i
client expects to receive over a given connection.

If h3i sees all of the exected frames over the course of the connection,
it will pre-emptively close the connection with a CONNECTION_CLOSE
frame. If h3i does _not_ see all of the expected frames, the resulting
ConnectionSummary will contain a list of the missing target frames for
future inspection.

This gives users a way to close tests out without waiting for the idle
timeout, or adding Wait/ConnectionClose actions to the end of each test.
This should vastly speed up test suites that have a large number of h3i
tests.
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/target-frame branch from 545f564 to 4f0ea98 Compare December 21, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants