Skip to content

Commit def4d9e

Browse files
committed
fix: get test runner working on vercel
1 parent 84b82bd commit def4d9e

File tree

9 files changed

+50
-24
lines changed

9 files changed

+50
-24
lines changed

packages/core/api-peer/src/runner_configs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pub struct ListQuery {
2121

2222
#[derive(Deserialize)]
2323
#[serde(deny_unknown_fields)]
24-
pub struct ListPath {
25-
pub namespace_id: Id,
26-
}
24+
pub struct ListPath {}
2725

2826
#[derive(Deserialize, Serialize, ToSchema)]
2927
#[serde(deny_unknown_fields)]
@@ -33,7 +31,7 @@ pub struct ListResponse {
3331
pub pagination: Pagination,
3432
}
3533

36-
pub async fn list(ctx: ApiCtx, path: ListPath, query: ListQuery) -> Result<ListResponse> {
34+
pub async fn list(ctx: ApiCtx, _path: ListPath, query: ListQuery) -> Result<ListResponse> {
3735
let namespace = ctx
3836
.op(namespace::ops::resolve_for_name_global::Input {
3937
name: query.namespace.clone(),

packages/infra/engine/tests/common/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl TestRunner {
2525

2626
let manifest_dir = env!("CARGO_MANIFEST_DIR");
2727
let runner_script_path =
28-
Path::new(manifest_dir).join("../../../sdks/typescript/test-runner/dist/main.js");
28+
Path::new(manifest_dir).join("../../../sdks/typescript/test-runner/dist/index.js");
2929

3030
if !runner_script_path.exists() {
3131
panic!(

packages/services/internal/src/ops/bump_serverless_autoscaler_global.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub async fn bump_serverless_autoscaler_global(ctx: &OperationCtx, input: &Input
2222
.await
2323
} else {
2424
// Remote datacenter - HTTP request
25-
request_remote_datacenter(
25+
request_remote_datacenter::<BumpServerlessAutoscalerResponse>(
2626
ctx.config(),
2727
dc.datacenter_label,
2828
"/bump-serverless-autoscaler",
@@ -32,6 +32,7 @@ pub async fn bump_serverless_autoscaler_global(ctx: &OperationCtx, input: &Input
3232
Option::<&()>::None,
3333
)
3434
.await
35+
.map(|_| ())
3536
}
3637
}
3738
}))
@@ -58,3 +59,7 @@ pub async fn bump_serverless_autoscaler_global(ctx: &OperationCtx, input: &Input
5859

5960
Ok(())
6061
}
62+
63+
// TODO: This is cloned from api-peer because of a cyclical dependency
64+
#[derive(Deserialize)]
65+
pub struct BumpServerlessAutoscalerResponse {}

packages/services/internal/src/ops/cache/purge_global.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub async fn cache_purge_global(ctx: &OperationCtx, input: &Input) -> Result<()>
3030
.await
3131
} else {
3232
// Remote datacenter - HTTP request
33-
request_remote_datacenter(
33+
request_remote_datacenter::<CachePurgeResponse>(
3434
ctx.config(),
3535
dc.datacenter_label,
3636
"/cache/purge",
@@ -43,6 +43,7 @@ pub async fn cache_purge_global(ctx: &OperationCtx, input: &Input) -> Result<()>
4343
}),
4444
)
4545
.await
46+
.map(|_| ())
4647
}
4748
}
4849
}))
@@ -76,3 +77,6 @@ pub struct CachePurgeRequest {
7677
pub base_key: String,
7778
pub keys: Vec<rivet_cache::RawCacheKey>,
7879
}
80+
81+
#[derive(Deserialize)]
82+
pub struct CachePurgeResponse {}

packages/services/namespace/src/ops/runner_config/get_global.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ pub async fn namespace_runner_config_get_global(
3838
let client = client.clone();
3939

4040
async move {
41+
let namespaces = ctx
42+
.op(crate::ops::get_global::Input {
43+
namespace_ids: runners
44+
.iter()
45+
.map(|(ns_id, _)| *ns_id)
46+
.collect(),
47+
})
48+
.await?;
49+
4150
let mut runner_names_by_namespace_id =
4251
HashMap::with_capacity(runners.len());
4352

@@ -50,11 +59,14 @@ pub async fn namespace_runner_config_get_global(
5059

5160
// TODO: Parallelize
5261
for (namespace_id, runner_names) in runner_names_by_namespace_id {
53-
let url = leader_dc
54-
.api_peer_url
55-
.join(&format!("/namespaces/{namespace_id}/runner-configs"))?;
62+
let namespace = namespaces
63+
.iter()
64+
.find(|n| n.namespace_id == namespace_id)
65+
.context("namespace not found")?;
66+
let url = leader_dc.api_peer_url.join("/runner-configs")?;
5667
let res = client
5768
.get(url)
69+
.query(&[("namespace", &namespace.name)])
5870
.query(
5971
&runner_names
6072
.iter()

sdks/typescript/test-runner/Dockerfile

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/typescript/test-runner/package.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/typescript/test-runner/src/main.ts renamed to sdks/typescript/test-runner/src/index.ts

Lines changed: 16 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"allowSyntheticDefaultImports": true,
99
"stripInternal": true,
1010
"moduleResolution": "bundler",
11-
"lib": ["ESNext"],
11+
"lib": ["ESNext", "DOM"],
1212
"types": ["node"]
1313
}
1414
}

0 commit comments

Comments
 (0)