MCPcopy
hub / github.com/questdb/questdb / testAllocate

Method testAllocate

core/src/test/java/io/questdb/test/FilesTest.java:75–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73 public final TemporaryFolder temporaryFolder = new TemporaryFolder();
74
75 @Test
76 public void testAllocate() throws Exception {
77 assertMemoryLeak(() -> {
78 File temp = temporaryFolder.newFile();
79 TestUtils.writeStringToFile(temp, "abcde");
80 try (Path path = new Path().of(temp.getAbsolutePath())) {
81 Assert.assertTrue(Files.exists(path.$()));
82 Assert.assertEquals(5, Files.length(path.$()));
83
84 long fd = Files.openRW(path.$());
85 try {
86 Files.allocate(fd, 10);
87 Assert.assertEquals(10, Files.length(path.$()));
88 Files.allocate(fd, 120);
89 Assert.assertEquals(120, Files.length(path.$()));
90 } finally {
91 Files.close(fd);
92 }
93 }
94 });
95 }
96
97 @Test
98 public void testAllocateConcurrent() throws IOException, InterruptedException {

Callers

nothing calls this directly

Calls 11

writeStringToFileMethod · 0.95
existsMethod · 0.95
lengthMethod · 0.95
openRWMethod · 0.95
allocateMethod · 0.95
closeMethod · 0.95
ofMethod · 0.65
$Method · 0.65
assertMemoryLeakMethod · 0.45
assertTrueMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected