use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class ConfigTest method shouldLogIfConfigFileCouldNotBeRead.
@Test
@DisabledForRoot
void shouldLogIfConfigFileCouldNotBeRead() throws IOException {
AssertableLogProvider logProvider = new AssertableLogProvider(true);
Log log = logProvider.getLog(Config.class);
Path confFile = testDirectory.file("test.conf");
assertTrue(confFile.toFile().createNewFile());
assumeTrue(confFile.toFile().setReadable(false));
Config config = Config.emptyBuilder().fromFileNoThrow(confFile).build();
config.setLogger(log);
assertThat(logProvider).containsMessages("Unable to load config file [%s]");
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class ConfigTest method testDoesNotLogChangedJvmArgs.
@Test
void testDoesNotLogChangedJvmArgs() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("dbms.jvm.additional=-XX:+UseG1GC", "dbms.jvm.additional=-XX:+AlwaysPreTouch", "dbms.jvm.additional=-XX:+UnlockExperimentalVMOptions", "dbms.jvm.additional=-XX:+TrustFinalNonStaticFields"));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).doesNotHaveAnyLogs();
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class ConfigTest method buildWithoutErrorsOrWarnings.
private static Config buildWithoutErrorsOrWarnings(Supplier<Config> buildConfig) {
AssertableLogProvider lp = new AssertableLogProvider();
Config config = buildConfig.get();
// The config uses a buffering log, when you supply it with a log (i.e. our mock) it replays the buffered log into it
config.setLogger(lp.getLog(Config.class));
assertThat(lp).forLevel(AssertableLogProvider.Level.WARN).doesNotHaveAnyLogs();
assertThat(lp).forLevel(AssertableLogProvider.Level.ERROR).doesNotHaveAnyLogs();
return config;
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method testConsistencyCheckerFailFastRename.
@Test
void testConsistencyCheckerFailFastRename() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("unsupported.consistency_checker.experimental.fail_fast=1"));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages("Use of deprecated setting unsupported.consistency_checker.experimental.fail_fast. " + "It is replaced by unsupported.consistency_checker.fail_fast_threshold");
assertEquals(1, config.get(GraphDatabaseInternalSettings.consistency_checker_fail_fast_threshold));
}
use of org.neo4j.logging.AssertableLogProvider in project neo4j by neo4j.
the class SettingMigratorsTest method testExperimentalConsistencyCheckerRemoval.
@Test
void testExperimentalConsistencyCheckerRemoval() throws IOException {
Path confFile = testDirectory.createFile("test.conf");
Files.write(confFile, List.of("unsupported.consistency_checker.experimental=true"));
Config config = Config.newBuilder().fromFile(confFile).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThat(logProvider).forClass(Config.class).forLevel(WARN).containsMessages("Setting unsupported.consistency_checker.experimental is removed. There is no longer multiple different consistency checkers to choose from.");
}
Aggregations