Skip to content

Commit 9f99286

Browse files
enhance tests
Signed-off-by: OneSizeFitsQuorum <[email protected]>
1 parent 91ba86c commit 9f99286

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/allocation/FirstCreateStrategyTest.java

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
2626
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.InsertRowNode;
2727
import org.apache.iotdb.db.storageengine.dataregion.wal.node.IWALNode;
28-
import org.apache.iotdb.db.storageengine.dataregion.wal.node.WALFakeNode;
2928
import org.apache.iotdb.db.storageengine.dataregion.wal.node.WALNode;
3029
import org.apache.iotdb.db.storageengine.dataregion.wal.utils.WALFileUtils;
3130
import org.apache.iotdb.db.utils.EnvironmentUtils;
@@ -47,7 +46,6 @@
4746
import static org.junit.Assert.assertEquals;
4847
import static org.junit.Assert.assertNotEquals;
4948
import static org.junit.Assert.assertNotNull;
50-
import static org.junit.Assert.assertNull;
5149
import static org.junit.Assert.assertTrue;
5250

5351
public class FirstCreateStrategyTest {
@@ -224,60 +222,6 @@ public void testReInitializeAfterDiskSpaceCleaned() throws IllegalPathException,
224222
}
225223
}
226224

227-
@Test
228-
public void testReInitializeFailsWhenDiskStillFull() throws IllegalPathException, IOException {
229-
// Create unique temporary directory for testing
230-
Path tempDir = Files.createTempDirectory("iotdb_wal_reinit_fail_test_");
231-
232-
// Use non-existent directories that will cause re-initialization to fail
233-
String[] nonExistentWalDirs =
234-
new String[] {
235-
tempDir.resolve("non_existent_dir1").toString(),
236-
tempDir.resolve("non_existent_dir2").toString(),
237-
tempDir.resolve("non_existent_dir3").toString()
238-
};
239-
240-
String[] originalWalDirs = commonConfig.getWalDirs();
241-
commonConfig.setWalDirs(nonExistentWalDirs);
242-
243-
try {
244-
// Create strategy - this will fail to initialize folderManager
245-
FirstCreateStrategy strategy = new FirstCreateStrategy();
246-
247-
// Verify that folderManager is null due to initialization failure
248-
try {
249-
java.lang.reflect.Field folderManagerField =
250-
AbstractNodeAllocationStrategy.class.getDeclaredField("folderManager");
251-
folderManagerField.setAccessible(true);
252-
Object folderManager = folderManagerField.get(strategy);
253-
assertNull("folderManager should be null due to initialization failure", folderManager);
254-
} catch (NoSuchFieldException | IllegalAccessException e) {
255-
throw new RuntimeException("Failed to access folderManager field", e);
256-
}
257-
258-
// Now apply for WAL node - re-initialization should also fail and return WALFakeNode
259-
IWALNode walNode = strategy.applyForWALNode("test_reinit_fail_identifier");
260-
261-
// Verify that WALFakeNode is returned when re-initialization fails
262-
assertNotNull("WAL node should be returned even when re-initialization fails", walNode);
263-
assertTrue(
264-
"Should return WALFakeNode when re-initialization fails", walNode instanceof WALFakeNode);
265-
266-
// WALFakeNode should be the failure instance
267-
WALFakeNode fakeNode = (WALFakeNode) walNode;
268-
assertTrue(
269-
"WALFakeNode should contain failure information",
270-
fakeNode.toString().contains("DiskSpaceInsufficientException")
271-
|| fakeNode.toString().contains("Failed to create WAL node"));
272-
273-
} finally {
274-
// Clean up temp directory
275-
EnvironmentUtils.cleanDir(tempDir.toString());
276-
// Restore original WAL directories
277-
commonConfig.setWalDirs(originalWalDirs);
278-
}
279-
}
280-
281225
private InsertRowNode getInsertRowNode() throws IllegalPathException {
282226
long time = 110L;
283227
TSDataType[] dataTypes =

0 commit comments

Comments
 (0)