-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from fastly/pch/fix_40
Use wasmtime-wasi in async mode
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
mod common; | ||
use common::{Test, TestResult}; | ||
use hyper::{body::to_bytes, StatusCode}; | ||
/// Run a program that only sleeps. This exercises async functionality in wasi. | ||
/// Check that an empty response is sent downstream by default. | ||
/// | ||
/// `sleep.wasm` is a guest program which sleeps for 100 milliseconds,then returns. | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn empty_ok_response_by_default_after_sleep() -> TestResult { | ||
let resp = Test::using_fixture("sleep.wasm").against_empty().await; | ||
|
||
assert_eq!(resp.status(), StatusCode::OK); | ||
assert!(to_bytes(resp.into_body()) | ||
.await | ||
.expect("can read body") | ||
.to_vec() | ||
.is_empty()); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
std::thread::sleep(std::time::Duration::from_millis(100)) | ||
} |