Skip to content

add graphman config check, place, pools to graphql api #5751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Prev Previous commit
Next Next commit
server: add test for graphman config place graphql api
  • Loading branch information
shiyasmohd committed Jan 7, 2025
commit 03ae4e8477fd5d86fecc8c63bb6f2733db40f045
76 changes: 76 additions & 0 deletions server/graphman/tests/config_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,79 @@ fn graphql_can_return_config_as_json_string() {
);
});
}

#[test]
fn graphql_can_check_how_specific_subgraph_would_be_placed() {
run_test(|| async {
let curr_dir = std::env::current_dir()
.unwrap()
.to_str()
.unwrap()
.to_string();
let config_dir = format!("{}/tests/test_config.toml", curr_dir);
std::env::set_var("GRAPH_NODE_CONFIG", config_dir);

let resp = send_graphql_request(
json!({
"query": r#"{
config {
place(subgraph: "subgraph_1", network: "bsc") {
subgraph
network
shards
nodes
}
}
}"#
}),
VALID_TOKEN,
)
.await;

let expected_resp = json!({
"data": {
"config": {
"place": {
"subgraph": String::from("subgraph_1"),
"network": String::from("bsc"),
"shards": vec!["primary".to_string(),"shard_a".to_string()],
"nodes": vec!["index_node_1_a".to_string(),"index_node_2_a".to_string(),"index_node_3_a".to_string()],
}
}
}
});

let resp_custom = send_graphql_request(
json!({
"query": r#"{
config {
place(subgraph: "custom/subgraph_1", network: "bsc") {
subgraph
network
shards
nodes
}
}
}"#
}),
VALID_TOKEN,
)
.await;

let expected_resp_custom = json!({
"data": {
"config": {
"place": {
"subgraph": String::from("custom/subgraph_1"),
"network": String::from("bsc"),
"shards": vec!["primary".to_string()],
"nodes": vec!["index_custom_0".to_string()],
}
}
}
});

assert_eq!(resp, expected_resp);
assert_eq!(resp_custom, expected_resp_custom);
});
}
Loading