Skip to content

Commit 7e3595b

Browse files
committed
fix: g-n-status-endpoint for DpmtDetail status_url
1 parent f43900c commit 7e3595b

File tree

2 files changed

+76
-52
lines changed

2 files changed

+76
-52
lines changed

common/src/subgraph_client/client.rs

Lines changed: 74 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ pub struct DeploymentDetails {
2121

2222
impl DeploymentDetails {
2323
pub fn for_graph_node(
24+
graph_node_status_url: &str,
2425
graph_node_base_url: &str,
2526
deployment: DeploymentId,
2627
) -> Result<Self, anyhow::Error> {
2728
Ok(Self {
2829
deployment: Some(deployment),
29-
status_url: Some(Url::parse(&format!("{graph_node_base_url}/status"))?),
30+
status_url: Some(Url::parse(graph_node_status_url)?),
3031
query_url: Url::parse(&format!("{graph_node_base_url}/subgraphs/id/{deployment}"))?,
3132
})
3233
}
@@ -206,23 +207,23 @@ mod test {
206207
let deployment =
207208
DeploymentId::from_str("QmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap();
208209

209-
let mock_server_local = MockServer::start().await;
210-
mock_server_local
211-
.register(
212-
Mock::given(method("POST"))
213-
.and(path("/status"))
214-
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
215-
"data": {
216-
"indexingStatuses": [
217-
{
218-
"synced": true,
219-
"health": "healthy"
220-
}
221-
]
222-
}
223-
}))),
224-
)
210+
let mock_server_status = MockServer::start().await;
211+
mock_server_status
212+
.register(Mock::given(method("POST")).respond_with(
213+
ResponseTemplate::new(200).set_body_json(json!({
214+
"data": {
215+
"indexingStatuses": [
216+
{
217+
"synced": true,
218+
"health": "healthy"
219+
}
220+
]
221+
}
222+
})),
223+
))
225224
.await;
225+
226+
let mock_server_local = MockServer::start().await;
226227
mock_server_local
227228
.register(
228229
Mock::given(method("POST"))
@@ -255,7 +256,14 @@ mod test {
255256
// Create the subgraph client
256257
let client = SubgraphClient::new(
257258
reqwest::Client::new(),
258-
Some(DeploymentDetails::for_graph_node(&mock_server_local.uri(), deployment).unwrap()),
259+
Some(
260+
DeploymentDetails::for_graph_node(
261+
&mock_server_status.uri(),
262+
&mock_server_local.uri(),
263+
deployment,
264+
)
265+
.unwrap(),
266+
),
259267
DeploymentDetails::for_query_url(&format!(
260268
"{}/subgraphs/id/{}",
261269
mock_server_remote.uri(),
@@ -278,23 +286,23 @@ mod test {
278286
let deployment =
279287
DeploymentId::from_str("QmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap();
280288

281-
let mock_server_local = MockServer::start().await;
282-
mock_server_local
283-
.register(
284-
Mock::given(method("POST"))
285-
.and(path("/status"))
286-
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
287-
"data": {
288-
"indexingStatuses": [
289-
{
290-
"synced": true,
291-
"health": "unhealthy"
292-
}
293-
]
294-
}
295-
}))),
296-
)
289+
let mock_server_status = MockServer::start().await;
290+
mock_server_status
291+
.register(Mock::given(method("POST")).respond_with(
292+
ResponseTemplate::new(200).set_body_json(json!({
293+
"data": {
294+
"indexingStatuses": [
295+
{
296+
"synced": true,
297+
"health": "unhealthy"
298+
}
299+
]
300+
}
301+
})),
302+
))
297303
.await;
304+
305+
let mock_server_local = MockServer::start().await;
298306
mock_server_local
299307
.register(
300308
Mock::given(method("POST"))
@@ -327,7 +335,14 @@ mod test {
327335
// Create the subgraph client
328336
let client = SubgraphClient::new(
329337
reqwest::Client::new(),
330-
Some(DeploymentDetails::for_graph_node(&mock_server_local.uri(), deployment).unwrap()),
338+
Some(
339+
DeploymentDetails::for_graph_node(
340+
&mock_server_status.uri(),
341+
&mock_server_local.uri(),
342+
deployment,
343+
)
344+
.unwrap(),
345+
),
331346
DeploymentDetails::for_query_url(&format!(
332347
"{}/subgraphs/id/{}",
333348
mock_server_remote.uri(),
@@ -350,23 +365,23 @@ mod test {
350365
let deployment =
351366
DeploymentId::from_str("QmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap();
352367

353-
let mock_server_local = MockServer::start().await;
354-
mock_server_local
355-
.register(
356-
Mock::given(method("POST"))
357-
.and(path("/status"))
358-
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
359-
"data": {
360-
"indexingStatuses": [
361-
{
362-
"synced": false,
363-
"health": "healthy"
364-
}
365-
]
366-
}
367-
}))),
368-
)
368+
let mock_server_status = MockServer::start().await;
369+
mock_server_status
370+
.register(Mock::given(method("POST")).respond_with(
371+
ResponseTemplate::new(200).set_body_json(json!({
372+
"data": {
373+
"indexingStatuses": [
374+
{
375+
"synced": false,
376+
"health": "healthy"
377+
}
378+
]
379+
}
380+
})),
381+
))
369382
.await;
383+
384+
let mock_server_local = MockServer::start().await;
370385
mock_server_local
371386
.register(
372387
Mock::given(method("POST"))
@@ -399,7 +414,14 @@ mod test {
399414
// Create the subgraph client
400415
let client = SubgraphClient::new(
401416
reqwest::Client::new(),
402-
Some(DeploymentDetails::for_graph_node(&mock_server_local.uri(), deployment).unwrap()),
417+
Some(
418+
DeploymentDetails::for_graph_node(
419+
&mock_server_status.uri(),
420+
&mock_server_local.uri(),
421+
deployment,
422+
)
423+
.unwrap(),
424+
),
403425
DeploymentDetails::for_query_url(&format!(
404426
"{}/subgraphs/id/{}",
405427
mock_server_remote.uri(),

service/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ async fn main() -> Result<(), std::io::Error> {
8282
.network_subgraph_deployment
8383
.map(|deployment| {
8484
DeploymentDetails::for_graph_node(
85+
&config.indexer_infrastructure.graph_node_status_endpoint,
8586
&config.indexer_infrastructure.graph_node_query_endpoint,
8687
deployment,
8788
)
@@ -128,6 +129,7 @@ async fn main() -> Result<(), std::io::Error> {
128129
.escrow_subgraph_deployment
129130
.map(|deployment| {
130131
DeploymentDetails::for_graph_node(
132+
&config.indexer_infrastructure.graph_node_status_endpoint,
131133
&config.indexer_infrastructure.graph_node_query_endpoint,
132134
deployment,
133135
)

0 commit comments

Comments
 (0)