-
Notifications
You must be signed in to change notification settings - Fork 21
feat(tests): add streaming HTTP integration test and example components #165
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
base: main
Are you sure you want to change the base?
Conversation
| cpu_limit: 2, | ||
| config: HashMap::new(), | ||
| environment: HashMap::new(), | ||
| volume_mounts: vec![], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know if LocaResources implemented Default, might be cleaner to use that instead:
local_resources: LocalResources {
allowed_hosts: vec!["generativelanguage.googleapis.com".to_string()],
..Default::default()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, LocalResources::default() is present
aab131e to
81e45c9
Compare
|
CC @lxfontes pretty sure the CI failure is a flake, So it's ready for a review |
|
I like the examples with streaming. Rebase on upstream/main. |
| use url::Url; | ||
|
|
||
| mod bindings { | ||
| wit_bindgen::generate!({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make the generated async trait and get rid of the code related to the executor
https://docs.rs/wit-bindgen/latest/wit_bindgen/macro.generate.html#options-to-generate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's neat! didn't know that was possible 😮
81e45c9 to
6feb1ce
Compare
6feb1ce to
f4b37d9
Compare
…ni proxy component Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
f4b37d9 to
fd85bbd
Compare
…onent Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
fd85bbd to
376a6c4
Compare
|
@lxfontes I've refactored the fixture part here and rebased, should be good for a review! |
Feature or Problem
This PR adds comprehensive testing and example components for streaming HTTP responses in wasmCloud, providing:
The streaming capability is essential for:
Related Issues
Release Information
Target:
nextreleaseConsumer Impact
Breaking Changes: None
Benefits:
Testing
Unit Test(s)
Acceptance or Integration
Added comprehensive integration test:
tests/integration_http_streaming.rsTest Design:
Example Components Included:
http_streaming.wasm- Deterministic test component for CI/CDhttp_ai_proxy.wasm- Real-world Gemini API proxy demonstrating AI streaming use casesTest Assertions:
Why this approach?
The integration test prioritizes reliability and determinism over realism. Using a controlled streaming pattern ensures tests won't fail due to:
The real-world Gemini proxy example is included to demonstrate practical streaming applications, but the CI test uses a predictable pattern.
Manual Verification
Built and ran both components:
http_streaming.wasm(test component with deterministic timing)http_ai_proxy.wasm(Gemini proxy example for real-world use)Deterministic Test Component:
Observed streaming behavior (Gemini example):
Both approaches confirm that the streaming implementation works correctly and components can continue streaming after the handler returns.