Skip to content

Commit 63f0a8f

Browse files
committed
server: improve warning message for graphman graphql api and clean up code
1 parent 2b60f8d commit 63f0a8f

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

server/graphman/src/entities/warning_response.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ pub struct CompletedWithWarnings {
66
}
77

88
impl CompletedWithWarnings {
9-
/// Returns a response with success & message.
10-
pub fn new(msg: Vec<String>) -> Self {
11-
Self { warnings: msg }
9+
pub fn new(warnings: Vec<String>) -> Self {
10+
Self { warnings }
1211
}
1312
}

server/graphman/src/resolvers/deployment_mutation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod reassign;
2020
mod restart;
2121
mod resume;
2222
mod unassign;
23+
2324
pub struct DeploymentMutation;
2425

2526
#[derive(Clone, Debug, Union)]
@@ -107,7 +108,7 @@ impl DeploymentMutation {
107108
let mirror = catalog::Mirror::primary_only(ctx.primary_pool);
108109
let count = mirror.assignments(&node)?.len();
109110
if count == 1 {
110-
let warning_msg = format!("warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?",node.as_str());
111+
let warning_msg = format!("This is the only deployment assigned to '{}'. Please make sure that the node ID is spelled correctly.",node.as_str());
111112
Ok(ReassignResponse::CompletedWithWarnings(
112113
CompletedWithWarnings::new(vec![warning_msg]),
113114
))

server/graphman/tests/deployment_mutation.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ fn graphql_allows_tracking_restart_deployment_executions() {
266266
assert_eq!(resp, expected_resp);
267267
});
268268
}
269-
<<<<<<< HEAD
270-
=======
271269

272270
#[test]
273271
fn graphql_can_create_new_subgraph() {
@@ -425,7 +423,7 @@ fn graphql_can_unassign_deployments() {
425423

426424
let subgraph_node_id = send_graphql_request(
427425
json!({
428-
"query": r#"query Deployment {
426+
"query": r#"{
429427
deployment {
430428
info(deployment: { hash: "subgraph_1" }) {
431429
nodeId
@@ -586,4 +584,3 @@ fn graphql_warns_reassign_on_wrong_node_id() {
586584
assert_eq!(reassign, expected_resp);
587585
});
588586
}
589-
>>>>>>> 5ab559557 (server: graphman graphql api tests added for unassign/reassign)

0 commit comments

Comments
 (0)