ulofiai commented on code in PR #3141:
URL: https://github.com/apache/hugegraph/pull/3141#discussion_r3735425307
##########
hugegraph-server/hugegraph-hstore/src/test/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImplTest.java:
##########
@@ -36,4 +39,30 @@ public void testProductionClassDoesNotReferenceTestAssert()
throws IOException {
"org/apache/hugegraph/testutil/Assert"));
}
}
+
+ @Test
+ public void testClearInitializedGraphStateRepeatedly() throws Exception {
+ Field initializedGraphField =
HstoreSessionsImpl.class.getDeclaredField(
+ "infoInitializedGraph");
+ initializedGraphField.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ Set<String> initializedGraphs =
+ (Set<String>) initializedGraphField.get(null);
+
+ Method clearInitializedGraph =
+ HstoreSessionsImpl.class.getDeclaredMethod(
+ "clearInitializedGraph", String.class);
+ clearInitializedGraph.setAccessible(true);
+
+ String graphName = "hugegraph/hstore-clear-test";
+ try {
+ for (int i = 0; i < 50; i++) {
+ Assert.assertTrue(initializedGraphs.add(graphName));
+ clearInitializedGraph.invoke(null, graphName);
Review Comment:
Thanks for catching this. You're right—the current test only exercises the
private helper and would not fail if clear() stopped invoking it. I'll replace
it with a public open → clear → open lifecycle test using controllable fakes
and verify that the graph is re-registered after clear.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]