diff --git a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java index db726f31c526df5b18714d5dbdc3c9179c7d21c0..c0dc9b97414d82f943e0741d96801d6aa4534f6b 100644 --- a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java @@ -66,7 +66,7 @@ public class DefaultMessageStoreCleanFilesTest { } @Test - public void testIsSpaceFullFunction() throws Exception { + public void testIsSpaceFullFunctionEmpty2Full() throws Exception { String deleteWhen = "04"; // the min value of diskMaxUsedSpaceRatio. int diskMaxUsedSpaceRatio = 1; @@ -85,16 +85,19 @@ public class DefaultMessageStoreCleanFilesTest { messageStore.shutdown(); messageStore.destroy(); + } + + @Test + public void testIsSpaceFullFunctionFull2Empty() throws Exception { + String deleteWhen = "04"; + // the min value of diskMaxUsedSpaceRatio. + int diskMaxUsedSpaceRatio = 1; //use to reset diskfull flag - diskSpaceCleanForciblyRatio = 0.999D; + double diskSpaceCleanForciblyRatio = 0.999D; initMessageStore(deleteWhen, diskMaxUsedSpaceRatio, diskSpaceCleanForciblyRatio); - // build and put 55 messages, exactly one message per CommitLog file. - buildAndPutMessagesToMessageStore(msgCount); - commitLogQueue = getMappedFileQueueCommitLog(); - assertEquals(fileCountCommitLog, commitLogQueue.getMappedFiles().size()); - fileCountConsumeQueue = getFileCountConsumeQueue(); - consumeQueue = getMappedFileQueueConsumeQueue(); - assertEquals(fileCountConsumeQueue, consumeQueue.getMappedFiles().size()); + //set disk full + messageStore.getRunningFlags().getAndMakeDiskFull(); + cleanCommitLogService.isSpaceFull(); assertEquals(0, messageStore.getRunningFlags().getFlagBits() & (1 << 4)); }