Skip to content

Commit d965ee8

Browse files
test: fix graphql_can_remove_subgraph test
The test was silently passing because remove_subgraph returned Ok(vecfor non-existent subgraphs. Now that SubgraphNotFound error is properly returned, the test needs to actually create the subgraph first. Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
1 parent b1eb896 commit d965ee8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

server/graphman/tests/deployment_mutation.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use graph::components::store::SubgraphStore;
66
use graph::prelude::DeploymentHash;
77
use serde::Deserialize;
88
use serde_json::json;
9-
use test_store::create_test_subgraph;
109
use test_store::SUBGRAPH_STORE;
10+
use test_store::{create_subgraph_name, create_test_subgraph};
1111
use tokio::time::sleep;
1212

1313
use self::util::client::send_graphql_request;
@@ -358,6 +358,8 @@ fn graphql_cannot_create_new_subgraph_with_invalid_name() {
358358
#[test]
359359
fn graphql_can_remove_subgraph() {
360360
run_test(|| async {
361+
create_subgraph_name("subgraph_1").await.unwrap();
362+
361363
let resp = send_graphql_request(
362364
json!({
363365
"query": r#"mutation RemoveSubgraph {

store/test-store/src/store.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ pub async fn create_test_subgraph_with_features(
259259
locator
260260
}
261261

262+
pub async fn create_subgraph_name(name: &str) -> Result<(), StoreError> {
263+
let subgraph_name = SubgraphName::new_unchecked(name.to_string());
264+
SUBGRAPH_STORE.create_subgraph(subgraph_name).await?;
265+
Ok(())
266+
}
267+
262268
pub async fn remove_subgraph(id: &DeploymentHash) {
263269
let name = SubgraphName::new_unchecked(id.to_string());
264270
SUBGRAPH_STORE.remove_subgraph(name).await.unwrap();

0 commit comments

Comments
 (0)