Skip to content

Commit 501adff

Browse files
committed
Fix chained cypher queries locking the test
For some reason SHOW index + DROP index does not work with dev
1 parent 51eb516 commit 501adff

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

core/src/test/java/org/neo4j/gds/core/loading/NodeLabelIndexTest.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
import org.neo4j.gds.extension.Neo4jGraph;
2828
import org.neo4j.gds.extension.Neo4jGraphExtension;
2929

30+
import java.util.ArrayList;
31+
import java.util.List;
32+
3033
import static org.assertj.core.api.Assertions.assertThat;
3134
import static org.neo4j.gds.TestSupport.assertGraphEquals;
3235
import static org.neo4j.gds.TestSupport.fromGdl;
@@ -39,17 +42,26 @@ public class NodeLabelIndexTest extends BaseTest {
3942

4043
@Test
4144
void shouldLoadWithoutNodeLabelIndex() {
42-
runQueryWithResultConsumer(
43-
"SHOW INDEXES WHERE entityType = 'NODE'",
45+
List<String> nodeIndices = runQuery(
46+
"SHOW INDEXES " +
47+
" YIELD name, entityType " +
48+
" WHERE entityType = 'NODE'" +
49+
" RETURN name",
4450
result -> {
45-
assertThat(result.hasNext()).isTrue();
46-
runQueryWithResultConsumer(
47-
"DROP INDEX " + result.next().get("name"),
48-
innerResult -> assertThat(innerResult.resultAsString()).contains("Indexes removed: 1")
49-
);
51+
var indices = new ArrayList<String>();
52+
while (result.hasNext()) {
53+
indices.add((String) result.next().get("name"));
54+
}
55+
return indices;
5056
}
5157
);
5258

59+
nodeIndices.forEach(index -> runQuery(
60+
"DROP INDEX " + index,
61+
result -> assertThat(result.resultAsString()).contains("Indexes removed: 1")
62+
));
63+
64+
5365
var log = Neo4jProxy.testLog();;
5466
var graph = new StoreLoaderBuilder()
5567
.databaseService(db)

0 commit comments

Comments
 (0)