use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class ConfigTest method shouldNotEvaluateK8sConfDirWithIncorrectFilePermission.
@Test
@DisabledOnOs({ OS.WINDOWS })
void shouldNotEvaluateK8sConfDirWithIncorrectFilePermission() throws IOException {
// Given
Path confDir = createK8sStyleConfigDir(PosixFilePermissions.fromString("rw-----w-"));
Config.Builder builder = Config.newBuilder().allowCommandExpansion().addSettingsClass(TestSettings.class).fromFile(confDir);
// Then
String msg = assertThrows(IllegalArgumentException.class, builder::build).getMessage();
String expectedErrorMessage = "does not have the correct file permissions";
assertThat(msg).contains(expectedErrorMessage);
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class TestGrowingFileMemoryMapping method shouldGrowAFileWhileContinuingToMemoryMapNewRegions.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldGrowAFileWhileContinuingToMemoryMapNewRegions() {
// given
final int NUMBER_OF_RECORDS = 1000000;
Config config = Config.defaults();
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(testDirectory.getFileSystem(), immediate(), databaseLayout.getDatabaseName());
StoreFactory storeFactory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, testDirectory.getFileSystem(), NullLogProvider.getInstance(), NULL, writable());
NeoStores neoStores = storeFactory.openAllNeoStores(true);
NodeStore nodeStore = neoStores.getNodeStore();
// when
int iterations = 2 * NUMBER_OF_RECORDS;
long startingId = nodeStore.nextId(CursorContext.NULL);
long nodeId = startingId;
for (int i = 0; i < iterations; i++) {
NodeRecord record = new NodeRecord(nodeId).initialize(false, 0, false, i, 0);
record.setInUse(true);
nodeStore.updateRecord(record, CursorContext.NULL);
nodeId = nodeStore.nextId(CursorContext.NULL);
}
// then
NodeRecord record = new NodeRecord(0).initialize(false, 0, false, 0, 0);
for (int i = 0; i < iterations; i++) {
record.setId(startingId + i);
nodeStore.getRecord(i, record, NORMAL, CursorContext.NULL);
assertTrue(record.inUse(), "record[" + i + "] should be in use");
assertThat(record.getNextRel()).as("record[" + i + "] should have nextRelId of " + i).isEqualTo(i);
}
neoStores.close();
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class LoadCommandTest method shouldHandleSymlinkToDatabaseDir.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldHandleSymlinkToDatabaseDir() throws IOException, CommandFailedException, IncorrectFormat {
Path symDir = testDirectory.directory("path-to-links");
Path realDatabaseDir = symDir.resolve("foo");
Path dataDir = testDirectory.directory("some-other-path");
Path databaseDir = dataDir.resolve("databases/foo");
Path txLogsDir = dataDir.resolve(DEFAULT_TX_LOGS_ROOT_DIR_NAME);
Path databasesDir = dataDir.resolve("databases");
Files.createDirectories(realDatabaseDir);
Files.createDirectories(databasesDir);
Files.createSymbolicLink(databaseDir, realDatabaseDir);
Files.write(configDir.resolve(Config.DEFAULT_CONFIG_FILE_NAME), singletonList(formatProperty(data_directory, dataDir)));
execute("foo", archive);
DatabaseLayout databaseLayout = createDatabaseLayout(dataDir, databasesDir, "foo", txLogsDir);
verify(loader).load(any(), eq(databaseLayout));
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class DumperTest method shouldGiveAClearErrorMessageIfTheArchivesParentDirectoryIsNotWritable.
@Test
@DisabledOnOs(OS.WINDOWS)
@DisabledForRoot
void shouldGiveAClearErrorMessageIfTheArchivesParentDirectoryIsNotWritable() throws IOException {
Path directory = testDirectory.directory("a-directory");
Path archive = testDirectory.file("subdir").resolve("the-archive.dump");
Files.createDirectories(archive.getParent());
try (Closeable ignored = TestUtils.withPermissions(archive.getParent(), emptySet())) {
AccessDeniedException exception = assertThrows(AccessDeniedException.class, () -> new Dumper().dump(directory, directory, archive, GZIP, Predicates.alwaysFalse()));
assertEquals(archive.getParent().toString(), exception.getMessage());
}
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class SingleFilePageSwapperTest method fileMustRemainLockedEvenIfChannelIsClosedByStrayInterrupt.
@Test
@DisabledOnOs(OS.WINDOWS)
void fileMustRemainLockedEvenIfChannelIsClosedByStrayInterrupt() throws Exception {
PageSwapperFactory factory = createSwapperFactory(fileSystem);
Path file = testDir.file("file");
((StoreChannel) fileSystem.write(file)).close();
PageSwapper pageSwapper = createSwapper(factory, file, 4, NO_CALLBACK, false);
try {
StoreChannel channel = fileSystem.write(file);
Thread.currentThread().interrupt();
pageSwapper.force();
assertThrows(OverlappingFileLockException.class, channel::tryLock);
} finally {
pageSwapper.close();
}
}
Aggregations