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
server: add tests for graphman config pools graphql api
  • Loading branch information
shiyasmohd committed Jan 8, 2025
commit 359df2b2a91619cb6b3d961f10b005ea061e2789
106 changes: 106 additions & 0 deletions server/graphman/tests/config_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,109 @@ fn graphql_can_check_how_specific_subgraph_would_be_placed() {
assert_eq!(resp_custom, expected_resp_custom);
});
}

#[test]
fn graphql_can_fetch_info_about_size_of_database_pools() {
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 {
pools(nodes: ["index_node_1_a", "index_node_2_a", "index_node_3_a"]) {
pools {
shards
node
}
}
}
}"#
}),
VALID_TOKEN,
)
.await;

let expected_resp = json!({
"data": {
"config": {
"pools": {
"pools": [
{
"shards": {
"primary": 2,
"shard_a": 2
},
"node": "index_node_1_a"
},
{
"shards": {
"primary": 10,
"shard_a": 10
},
"node": "index_node_2_a"
},
{
"shards": {
"primary": 10,
"shard_a": 10
},
"node": "index_node_3_a"
}
]
}
}
}
});

assert_eq!(resp, expected_resp);
});
}

#[test]
fn graphql_can_fetch_connections_by_shard() {
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 {
pools(nodes: ["index_node_1_a", "index_node_2_a", "index_node_3_a"]) {
shards
}
}
}"#
}),
VALID_TOKEN,
)
.await;

let expected_resp = json!({
"data": {
"config": {
"pools": {
"shards": {
"primary": 22,
"shard_a": 22
}
}
}
}
});

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