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
16 changes: 16 additions & 0 deletions raphtory-graphql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3671,4 +3671,20 @@ mod graphql_test {
} } } })
);
}

#[tokio::test]
async fn test_subgraph_on_uncached() {
let tmp_dir = TempDir::new().unwrap();
let g = Graph::new();
g.add_node(0, 1, NO_PROPS, None, None).unwrap();
setup_with_graphs(&[("g", g.into())], tmp_dir.path()).await; // write to folder and drop the cache
let setup = setup_with_graphs(&[], tmp_dir.path()).await; // new data pointing at the folder with the graph unloaded

let query = r#"
mutation {
createSubgraph(newPath: "sg", parentPath: "g", nodes: [1], overwrite: false)
}"#;
let res = run_mutation(&setup.schema, query).await;
assert_eq!(res.errors, vec![], "{:?}", res.errors);
}
}
6 changes: 3 additions & 3 deletions raphtory-graphql/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,13 @@ impl Mut {
let data = ctx.data_unchecked::<Data>();
let dst_ns = parent_namespace(&new_path);
require_namespace_write(ctx, &data.auth_policy, dst_ns, &new_path, "create")?;
let (_, parent_graph) = data
.get_graph_requiring_read(ctx, parent_path, None)
.await?;
let folder = data
.work_dir_write()
.await
.validate_path_for_insert(&new_path, overwrite)?;
let (_, parent_graph) = data
.get_graph_requiring_read(ctx, parent_path, None)
.await?;
let folder_clone = folder.clone();
let new_subgraph = blocking_compute(move || {
let subgraph = parent_graph.subgraph(nodes);
Expand Down
Loading