提交 dcb7c081 编写于 作者: Q qqeasonchen

unit test of statistics persistence modified

上级 d4c4baf2
...@@ -66,7 +66,7 @@ public class DefaultMessageStoreCleanFilesTest { ...@@ -66,7 +66,7 @@ public class DefaultMessageStoreCleanFilesTest {
} }
@Test @Test
public void testIsSpaceFullFunction() throws Exception { public void testIsSpaceFullFunctionEmpty2Full() throws Exception {
String deleteWhen = "04"; String deleteWhen = "04";
// the min value of diskMaxUsedSpaceRatio. // the min value of diskMaxUsedSpaceRatio.
int diskMaxUsedSpaceRatio = 1; int diskMaxUsedSpaceRatio = 1;
...@@ -85,16 +85,19 @@ public class DefaultMessageStoreCleanFilesTest { ...@@ -85,16 +85,19 @@ public class DefaultMessageStoreCleanFilesTest {
messageStore.shutdown(); messageStore.shutdown();
messageStore.destroy(); messageStore.destroy();
}
@Test
public void testIsSpaceFullFunctionFull2Empty() throws Exception {
String deleteWhen = "04";
// the min value of diskMaxUsedSpaceRatio.
int diskMaxUsedSpaceRatio = 1;
//use to reset diskfull flag //use to reset diskfull flag
diskSpaceCleanForciblyRatio = 0.999D; double diskSpaceCleanForciblyRatio = 0.999D;
initMessageStore(deleteWhen, diskMaxUsedSpaceRatio, diskSpaceCleanForciblyRatio); initMessageStore(deleteWhen, diskMaxUsedSpaceRatio, diskSpaceCleanForciblyRatio);
// build and put 55 messages, exactly one message per CommitLog file. //set disk full
buildAndPutMessagesToMessageStore(msgCount); messageStore.getRunningFlags().getAndMakeDiskFull();
commitLogQueue = getMappedFileQueueCommitLog();
assertEquals(fileCountCommitLog, commitLogQueue.getMappedFiles().size());
fileCountConsumeQueue = getFileCountConsumeQueue();
consumeQueue = getMappedFileQueueConsumeQueue();
assertEquals(fileCountConsumeQueue, consumeQueue.getMappedFiles().size());
cleanCommitLogService.isSpaceFull(); cleanCommitLogService.isSpaceFull();
assertEquals(0, messageStore.getRunningFlags().getFlagBits() & (1 << 4)); assertEquals(0, messageStore.getRunningFlags().getFlagBits() & (1 << 4));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册