You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/05/22 07:59:56 UTC
[iotdb] branch tiered_storage updated: add more UT
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch tiered_storage
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/tiered_storage by this push:
new 80bf822d0d7 add more UT
80bf822d0d7 is described below
commit 80bf822d0d778cb022d42b0f3db7461296c38524
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Mon May 22 15:59:44 2023 +0800
add more UT
---
.../org/apache/iotdb/os/cache/OSFileChannelTest.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/object-storage/src/test/java/org/apache/iotdb/os/cache/OSFileChannelTest.java b/object-storage/src/test/java/org/apache/iotdb/os/cache/OSFileChannelTest.java
index bb09faa2de9..7fcb87ed5a9 100644
--- a/object-storage/src/test/java/org/apache/iotdb/os/cache/OSFileChannelTest.java
+++ b/object-storage/src/test/java/org/apache/iotdb/os/cache/OSFileChannelTest.java
@@ -123,6 +123,22 @@ public class OSFileChannelTest {
}
}
+ @Test
+ public void testByteBufferBiggerThanFileSize() throws Exception {
+ int fileSize = 550;
+ int byteBufferSize = 600;
+ prepareOSFile(fileSize);
+ try (OSFileChannel channel = new OSFileChannel(testFile, cache)) {
+ ByteBuffer dst = ByteBuffer.allocate(byteBufferSize);
+ assertEquals(fileSize, channel.read(dst));
+ assertEquals(byteBufferSize, dst.limit());
+ dst.flip();
+ for (int i = 0; i < fileSize; ++i) {
+ assertEquals((byte) i, dst.get());
+ }
+ }
+ }
+
@Test
public void testReadByPosition() throws Exception {
int size = 550;