Skip to content

Commit decb7d4

Browse files
committed
test cleanup
1 parent 49b5df0 commit decb7d4

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

core/src/test/java/io/questdb/test/ServerMainTest.java

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,35 @@ public void setUp() {
6666
@Test
6767
public void testAsyncMunmap() throws Exception {
6868
assertMemoryLeak(() -> {
69-
Map<String, String> env = new HashMap<>(System.getenv());
70-
env.put(PropertyKey.CAIRO_FILE_ASYNC_MUNMAP_ENABLED.getEnvVarName(), "true");
71-
Bootstrap bootstrap = new Bootstrap(
72-
new DefaultBootstrapConfiguration() {
73-
@Override
74-
public Map<String, String> getEnv() {
75-
return env;
76-
}
77-
},
78-
getServerMainArgs()
79-
);
80-
try (final ServerMain serverMain = new ServerMain(bootstrap)) {
81-
serverMain.start();
69+
try {
70+
Map<String, String> env = new HashMap<>(System.getenv());
71+
env.put(PropertyKey.CAIRO_FILE_ASYNC_MUNMAP_ENABLED.getEnvVarName(), "true");
72+
73+
Bootstrap bootstrap;
74+
try {
75+
bootstrap = new Bootstrap(
76+
new DefaultBootstrapConfiguration() {
77+
@Override
78+
public Map<String, String> getEnv() {
79+
return env;
80+
}
81+
},
82+
getServerMainArgs()
83+
);
84+
} catch (Bootstrap.BootstrapException ex) {
85+
if (!Os.isWindows()) {
86+
throw ex;
87+
}
88+
TestUtils.assertContains(ex.getMessage(), "Async munmap is not supported on Windows");
89+
return;
90+
}
91+
92+
Assert.assertFalse(Os.isWindows());
93+
try (final ServerMain serverMain = new ServerMain(bootstrap)) {
94+
serverMain.start();
95+
}
96+
} finally {
97+
Files.ASYNC_MUNMAP_ENABLED = false;
8298
}
8399
});
84100
}

0 commit comments

Comments
 (0)