fix: release Dever 0.1.6 with shared runtime assets and unbounded workers
This commit is contained in:
1 parent
a900d7e8db
commit
5589b657db
17 files changed
+357
-49
No files matched your search
@@ -14,7 +14,7 @@ const OPERATIONS: &[&str] = &[
|
||||
"echo",
|
||||
"fail",
|
||||
"wait",
|
||||
"timeout",
|
||||
"delayed",
|
||||
"crash",
|
||||
"duplicate",
|
||||
"out_of_order",
|
||||
@@ -23,6 +23,28 @@ const OPERATIONS: &[&str] = &[
|
||||
"truncated",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn component_call_can_run_longer_than_thirty_seconds() {
|
||||
let fixture = install_fixture();
|
||||
dever_runtime::task::run_entry(async {
|
||||
fixture.prepare()?;
|
||||
component::start(definition("long_call", fixture.entry, "normal", 2_000)).await?;
|
||||
let result = tokio::time::timeout(
|
||||
std::time::Duration::from_secs(40),
|
||||
component::call("long_call", "delayed", &payload(31_000)),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| "long-call fixture did not finish")??;
|
||||
match result {
|
||||
Reply::Result(body) => assert_eq!(body, r#"{"value":31000}"#),
|
||||
Reply::Error { .. } => return Err("long call returned an error".into()),
|
||||
}
|
||||
component::shutdown().await
|
||||
})
|
||||
.expect("long external invocation has no implicit execution deadline");
|
||||
assert!(fixture.path.with_extension("shutdown").is_file());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn component_protocol_and_lifecycle_are_bounded() {
|
||||
let fixture = install_fixture();
|
||||
@@ -159,14 +181,20 @@ async fn normal_lifecycle(entry: &'static str) -> Result<(), String> {
|
||||
.await
|
||||
.map_err(|error| format!("cancel wait: {error}"))?;
|
||||
|
||||
let timeout = component::call("normal", "timeout", &payload(0))
|
||||
.await
|
||||
.expect_err("timeout operation must reach the deadline");
|
||||
assert_eq!(timeout, "external Adapter call timed out");
|
||||
match tokio::time::timeout(
|
||||
std::time::Duration::from_secs(2),
|
||||
component::call("normal", "delayed", &payload(150)),
|
||||
)
|
||||
.await
|
||||
.expect("fixture call must finish")?
|
||||
{
|
||||
Reply::Result(body) => assert_eq!(body, r#"{"value":150}"#),
|
||||
Reply::Error { .. } => return Err("delayed call returned a business error".into()),
|
||||
}
|
||||
assert!(matches!(
|
||||
component::call("normal", "echo", &payload(3))
|
||||
.await
|
||||
.map_err(|error| format!("echo after timeout: {error}"))?,
|
||||
.map_err(|error| format!("echo after delayed call: {error}"))?,
|
||||
Reply::Result(_)
|
||||
));
|
||||
|
||||
@@ -248,7 +276,7 @@ fn definition(
|
||||
key: &'static str,
|
||||
entry: &'static str,
|
||||
mode: &'static str,
|
||||
timeout_ms: u64,
|
||||
protocol_timeout_ms: u64,
|
||||
) -> Definition {
|
||||
let (_, setting) = component::adapter_settings()
|
||||
.unwrap()
|
||||
@@ -266,7 +294,7 @@ fn definition(
|
||||
capabilities: vec!["network".into(), "file".into()],
|
||||
operations: OPERATIONS.iter().map(|name| (*name).into()).collect(),
|
||||
setting: Some(setting.to_string()),
|
||||
timeout_ms,
|
||||
protocol_timeout_ms,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user