use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class AbstractFileSystemTest method initializeWithZookeeperUriAndSystemProperty.
@Test
public void initializeWithZookeeperUriAndSystemProperty() throws Exception {
// those in the URI has the highest priority.
try (Closeable p = new SystemPropertyRule(PropertyKey.ZOOKEEPER_ENABLED.getName(), "false").toResource()) {
ConfigurationUtils.reloadProperties();
URI uri = URI.create("alluxio://zk@zkHost:2181");
FileSystem fs = getHadoopFilesystem(org.apache.hadoop.fs.FileSystem.get(uri, getConf()));
assertTrue(fs.mFileSystem.getConf().getBoolean(PropertyKey.ZOOKEEPER_ENABLED));
assertEquals("zkHost:2181", fs.mFileSystem.getConf().get(PropertyKey.ZOOKEEPER_ADDRESS));
fs.close();
}
HashMap<String, String> sysProps = new HashMap<>();
sysProps.put(PropertyKey.ZOOKEEPER_ENABLED.getName(), "true");
sysProps.put(PropertyKey.ZOOKEEPER_ADDRESS.getName(), "zkHost1:2181");
try (Closeable p = new SystemPropertyRule(sysProps).toResource()) {
ConfigurationUtils.reloadProperties();
URI uri = URI.create("alluxio://zk@zkHost2:2181");
FileSystem fs = getHadoopFilesystem(org.apache.hadoop.fs.FileSystem.get(uri, getConf()));
assertTrue(fs.mFileSystem.getConf().getBoolean(PropertyKey.ZOOKEEPER_ENABLED));
assertEquals("zkHost2:2181", fs.mFileSystem.getConf().get(PropertyKey.ZOOKEEPER_ADDRESS));
fs.close();
}
ConfigurationUtils.reloadProperties();
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class InstancedConfigurationTest method alias.
@Test
public void alias() throws Exception {
try (Closeable p = new SystemPropertyRule("alluxio.master.worker.timeout.ms", "100").toResource()) {
resetConf();
assertEquals(100, mConfiguration.getMs(PropertyKey.MASTER_WORKER_TIMEOUT_MS));
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class InstancedConfigurationTest method wrongTieredStorageLevel.
@Test
public void wrongTieredStorageLevel() throws Exception {
try (Closeable p = new SystemPropertyRule(ImmutableMap.of("alluxio.master.tieredstore.global.levels", "1", "alluxio.worker.tieredstore.levels", "2")).toResource()) {
resetConf();
mConfiguration.validate();
fail("Should have thrown a runtime exception when setting an unknown tier level");
} catch (RuntimeException e) {
assertTrue(e.getMessage().contains(String.format("%s tiers on worker (configured by %s), larger than global %s tiers " + "(configured by %s) ", 2, PropertyKey.WORKER_TIERED_STORE_LEVELS, 1, PropertyKey.MASTER_TIERED_STORE_GLOBAL_LEVELS)));
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class InstancedConfigurationTest method systemPropertySubstitution.
@Test
public void systemPropertySubstitution() throws Exception {
try (Closeable p = new SystemPropertyRule("user.home", "/home").toResource()) {
resetConf();
mConfiguration.set(PropertyKey.WORK_DIR, "${user.home}/work");
assertEquals("/home/work", mConfiguration.get(PropertyKey.WORK_DIR));
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class InstancedConfigurationTest method initConfWithExtenstionProperty.
@Test
public void initConfWithExtenstionProperty() throws Exception {
try (Closeable p = new SystemPropertyRule("alluxio.master.journal.ufs.option.fs.obs.endpoint", "foo").toResource()) {
resetConf();
assertEquals("foo", mConfiguration.get(Template.MASTER_JOURNAL_UFS_OPTION_PROPERTY.format("fs.obs.endpoint")));
}
}
Aggregations