From bbb723fb805357d0fb5caf2282c499d89469e994 Mon Sep 17 00:00:00 2001 From: Eks OU Date: Sat, 2 Mar 2019 09:55:40 +0800 Subject: [PATCH] [RIP-10]Optimize the test case for DefaultMessageStore.CleanCommitLogService and DefaultMessageStore.CleanConsumeQueueService (#939) [RIP-10]Optimize the test case for DefaultMessageStore.CleanCommitLogService and DefaultMessageStore.CleanConsumeQueueService --- .../store/DefaultMessageStoreCleanFilesTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 cf970e6d..b987cd38 100644 --- a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreCleanFilesTest.java @@ -107,7 +107,7 @@ public class DefaultMessageStoreCleanFilesTest { @Test public void testDeleteExpiredFilesBySpaceFull() throws Exception { String deleteWhen = "04"; - // the min value of diskMaxUsedSpaceRatio. make sure disk space usage is greater than 10% + // the min value of diskMaxUsedSpaceRatio. int diskMaxUsedSpaceRatio = 1; // used to ensure that automatic file deletion is not triggered double diskSpaceCleanForciblyRatio = 0.999D; @@ -146,7 +146,7 @@ public class DefaultMessageStoreCleanFilesTest { @Test public void testDeleteFilesImmediatelyBySpaceFull() throws Exception { String deleteWhen = "04"; - // the min value of diskMaxUsedSpaceRatio. make sure disk space usage is greater than 10% + // the min value of diskMaxUsedSpaceRatio. int diskMaxUsedSpaceRatio = 1; // make sure to trigger the automatic file deletion feature double diskSpaceCleanForciblyRatio = 0.01D; @@ -304,8 +304,9 @@ public class DefaultMessageStoreCleanFilesTest { assertTrue(result != null && result.isOk()); } - // wait for build consumer queue completion - Thread.sleep(100); + StoreTestUtil.waitCommitLogReput(messageStore); + StoreTestUtil.flushConsumeQueue(messageStore); + StoreTestUtil.flushConsumeIndex(messageStore); } private void expireFiles(MappedFileQueue commitLogQueue, int expireCount) { -- GitLab