diff --git a/cli/tests/integration/args.rs b/cli/tests/integration/args.rs index 05da27da..9c5c95b2 100644 --- a/cli/tests/integration/args.rs +++ b/cli/tests/integration/args.rs @@ -1,5 +1,6 @@ use crate::common::{Test, TestResult}; use hyper::{body::to_bytes, StatusCode}; + /// Run a program that tests its args. This checks that we're populating the argument list with the /// singleton "compute-app" value. /// Check that an empty response is sent downstream by default. @@ -18,3 +19,22 @@ async fn empty_ok_response_by_default_after_args() -> TestResult { Ok(()) } + +/// Run a program that tests its args. This checks that we're populating the argument list with the +/// singleton "compute-app" value. +/// Check that an empty response is sent downstream by default. +/// +/// `args.wasm` is a guest program checks its cli args. +#[tokio::test(flavor = "multi_thread")] +async fn empty_ok_response_by_default_after_args_component() -> TestResult { + let resp = Test::using_fixture("args.wasm").adapt_component().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(()) +} diff --git a/lib/src/execute.rs b/lib/src/execute.rs index 2df61456..7654bf18 100644 --- a/lib/src/execute.rs +++ b/lib/src/execute.rs @@ -454,8 +454,10 @@ impl ExecuteCtx { let req = session.downstream_request(); let body = session.downstream_request_body(); - let mut store = ComponentCtx::create_store(&self, session, None, |_| {}) - .map_err(ExecutionError::Context)?; + let mut store = ComponentCtx::create_store(&self, session, None, |ctx| { + ctx.arg("compute-app"); + }) + .map_err(ExecutionError::Context)?; let (compute, _instance) = compute::Compute::instantiate_pre(&mut store, instance_pre)