Skip to content

Commit

Permalink
fix unit test on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhimins committed Nov 20, 2023
1 parent ef9ac31 commit a1afabe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void init() throws IOException {
UUID.randomUUID().toString().replace("-", "").substring(0, 8)).toString();
storeConfig = new TieredMessageStoreConfig();
storeConfig.setStorePathRootDir(filePath);
storeConfig.setTieredStoreFilePath(filePath);
storeConfig.setTieredStoreIndexFileMaxHashSlotNum(5);
storeConfig.setTieredStoreIndexFileMaxIndexNum(20);
storeConfig.setTieredBackendServiceProvider("org.apache.rocketmq.tieredstore.provider.posix.PosixFileSegment");
Expand All @@ -73,6 +74,7 @@ public void shutdown() {
this.indexStoreFile.destroy();
}
TieredStoreTestUtil.destroyMetadataStore();
TieredStoreTestUtil.destroyTempDir(storeConfig.getStorePathRootDir());
TieredStoreTestUtil.destroyTempDir(storeConfig.getTieredStoreFilePath());
TieredStoreExecutor.shutdown();
}
Expand Down Expand Up @@ -222,7 +224,7 @@ public void doCompactionTest() throws Exception {

ByteBuffer byteBuffer = indexStoreFile.doCompaction();
TieredFileSegment fileSegment = new PosixFileSegment(
storeConfig, FileSegmentType.INDEX, "store_index", 0L);
storeConfig, FileSegmentType.INDEX, storeConfig.getTieredStoreFilePath(), 0L);
fileSegment.append(byteBuffer, timestamp);
fileSegment.commit();
Assert.assertEquals(byteBuffer.limit(), fileSegment.getSize());
Expand Down Expand Up @@ -255,7 +257,7 @@ public void queryAsyncFromSegmentFileTest() throws ExecutionException, Interrupt

ByteBuffer byteBuffer = indexStoreFile.doCompaction();
TieredFileSegment fileSegment = new PosixFileSegment(
storeConfig, FileSegmentType.INDEX, "store_index", 0L);
storeConfig, FileSegmentType.INDEX, storeConfig.getTieredStoreFilePath(), 0L);
fileSegment.append(byteBuffer, timestamp);
fileSegment.commit();
Assert.assertEquals(byteBuffer.limit(), fileSegment.getSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.rocketmq.logging.org.slf4j.Logger;
import org.apache.rocketmq.logging.org.slf4j.LoggerFactory;
import org.apache.rocketmq.store.logfile.DefaultMappedFile;
import org.apache.rocketmq.tieredstore.TieredStoreTestUtil;
import org.apache.rocketmq.tieredstore.common.AppendResult;
import org.apache.rocketmq.tieredstore.common.TieredMessageStoreConfig;
import org.apache.rocketmq.tieredstore.common.TieredStoreExecutor;
Expand Down Expand Up @@ -72,6 +73,7 @@ public void init() throws IOException, ClassNotFoundException, NoSuchMethodExcep
UUID.randomUUID().toString().replace("-", "").substring(0, 8)).toString();
storeConfig = new TieredMessageStoreConfig();
storeConfig.setStorePathRootDir(filePath);
storeConfig.setTieredStoreFilePath(filePath);
storeConfig.setTieredStoreIndexFileMaxHashSlotNum(5);
storeConfig.setTieredStoreIndexFileMaxIndexNum(20);
storeConfig.setTieredBackendServiceProvider("org.apache.rocketmq.tieredstore.provider.posix.PosixFileSegment");
Expand All @@ -84,6 +86,9 @@ public void shutdown() {
indexService.shutdown();
indexService.destroy();
}
TieredStoreTestUtil.destroyMetadataStore();
TieredStoreTestUtil.destroyTempDir(storeConfig.getStorePathRootDir());
TieredStoreTestUtil.destroyTempDir(storeConfig.getTieredStoreFilePath());
TieredStoreExecutor.shutdown();
}

Expand Down

0 comments on commit a1afabe

Please sign in to comment.