Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion server/graphman/src/entities/warning_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ use async_graphql::SimpleObject;

#[derive(Clone, Debug, SimpleObject)]
pub struct CompletedWithWarnings {
pub success: bool,
pub warnings: Vec<String>,
}

impl CompletedWithWarnings {
pub fn new(warnings: Vec<String>) -> Self {
Self { warnings }
Self {
success: true,
warnings,
}
}
}
18 changes: 14 additions & 4 deletions server/graphman/tests/deployment_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ pub mod util;

use std::time::Duration;

use graph::components::store::SubgraphStore;
use graph::prelude::DeploymentHash;
use serde::Deserialize;
use serde_json::json;
use test_store::create_test_subgraph;
use test_store::SUBGRAPH_STORE;
use tokio::time::sleep;

use self::util::client::send_graphql_request;
Expand Down Expand Up @@ -497,7 +499,7 @@ fn graphql_can_reassign_deployment() {
create_test_subgraph(&deployment_hash, TEST_SUBGRAPH_SCHEMA).await;

let deployment_hash = DeploymentHash::new("subgraph_2").unwrap();
create_test_subgraph(&deployment_hash, TEST_SUBGRAPH_SCHEMA).await;
let locator = create_test_subgraph(&deployment_hash, TEST_SUBGRAPH_SCHEMA).await;

send_graphql_request(
json!({
Expand All @@ -513,20 +515,26 @@ fn graphql_can_reassign_deployment() {
)
.await;

let node = SUBGRAPH_STORE.assigned_node(&locator).unwrap().unwrap();

let reassign = send_graphql_request(
json!({
"query": r#"mutation {
"query": r#"mutation ReassignDeployment($node: String!) {
deployment {
reassign(deployment: { hash: "subgraph_1" }, node: "test") {
reassign(deployment: { hash: "subgraph_1" }, node: $node) {
... on EmptyResponse {
success
}
... on CompletedWithWarnings {
success
warnings
}
}
}
}"#
}"#,
"variables": {
"node": node.to_string(),
}
}),
VALID_TOKEN,
)
Expand Down Expand Up @@ -561,6 +569,7 @@ fn graphql_warns_reassign_on_wrong_node_id() {
success
}
... on CompletedWithWarnings {
success
warnings
}
}
Expand All @@ -575,6 +584,7 @@ fn graphql_warns_reassign_on_wrong_node_id() {
"data": {
"deployment": {
"reassign": {
"success": true,
"warnings": ["This is the only deployment assigned to 'invalid_node'. Please make sure that the node ID is spelled correctly."],
}
}
Expand Down
Loading