Skip to content

Commit 546b02a

Browse files
Revert "For now revert the changes to the test services to run once the integration tests"
This reverts commit ae09e68.
1 parent 752e7d8 commit 546b02a

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

test-services/src/proxy.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub(crate) trait Proxy {
4646
#[name = "call"]
4747
async fn call(req: Json<ProxyRequest>) -> HandlerResult<Json<Vec<u8>>>;
4848
#[name = "oneWayCall"]
49-
async fn one_way_call(req: Json<ProxyRequest>) -> HandlerResult<()>;
49+
async fn one_way_call(req: Json<ProxyRequest>) -> HandlerResult<String>;
5050
#[name = "manyCalls"]
5151
async fn many_calls(req: Json<Vec<ManyCallRequest>>) -> HandlerResult<()>;
5252
}
@@ -70,16 +70,19 @@ impl Proxy for ProxyImpl {
7070
&self,
7171
ctx: Context<'_>,
7272
Json(req): Json<ProxyRequest>,
73-
) -> HandlerResult<()> {
73+
) -> HandlerResult<String> {
7474
let request = ctx.request::<_, ()>(req.to_target(), req.message);
7575

76-
if let Some(delay_millis) = req.delay_millis {
77-
request.send_after(Duration::from_millis(delay_millis));
76+
let invocation_id = if let Some(delay_millis) = req.delay_millis {
77+
request
78+
.send_after(Duration::from_millis(delay_millis))
79+
.invocation_id()
80+
.await?
7881
} else {
79-
request.send();
80-
}
82+
request.send().invocation_id().await?
83+
};
8184

82-
Ok(())
85+
Ok(invocation_id)
8386
}
8487

8588
async fn many_calls(

test-services/src/test_utils_service.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ pub(crate) trait TestUtilsService {
6262
async fn count_executed_side_effects(increments: u32) -> HandlerResult<u32>;
6363
#[name = "getEnvVariable"]
6464
async fn get_env_variable(env: String) -> HandlerResult<String>;
65+
#[name = "cancelInvocation"]
66+
async fn cancel_invocation(invocation_id: String) -> Result<(), TerminalError>;
6567
#[name = "interpretCommands"]
6668
async fn interpret_commands(req: Json<InterpretRequest>) -> HandlerResult<()>;
6769
}
@@ -155,6 +157,15 @@ impl TestUtilsService for TestUtilsServiceImpl {
155157
Ok(std::env::var(env).ok().unwrap_or_default())
156158
}
157159

160+
async fn cancel_invocation(
161+
&self,
162+
ctx: Context<'_>,
163+
invocation_id: String,
164+
) -> Result<(), TerminalError> {
165+
ctx.invocation_handle(invocation_id).cancel().await?;
166+
Ok(())
167+
}
168+
158169
async fn interpret_commands(
159170
&self,
160171
context: Context<'_>,

0 commit comments

Comments
 (0)