}
@Test
public void testUpdateSettings() throws IOException {
{
IndexSettingsService service = new IndexSettingsService(new Index("test"), EMPTY_SETTINGS);
TieredMergePolicyProvider mp = new TieredMergePolicyProvider(createStore(EMPTY_SETTINGS), service);
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
service.refreshSettings(build(1.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(1.0));
service.refreshSettings(build(0.1));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.1));
service.refreshSettings(build(0.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
}
{
IndexSettingsService service = new IndexSettingsService(new Index("test"), EMPTY_SETTINGS);
LogByteSizeMergePolicyProvider mp = new LogByteSizeMergePolicyProvider(createStore(EMPTY_SETTINGS), service);
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
service.refreshSettings(build(1.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(1.0));
service.refreshSettings(build(0.1));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.1));
service.refreshSettings(build(0.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
}
{
IndexSettingsService service = new IndexSettingsService(new Index("test"), EMPTY_SETTINGS);
LogDocMergePolicyProvider mp = new LogDocMergePolicyProvider(createStore(EMPTY_SETTINGS), service);
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
service.refreshSettings(build(1.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(1.0));
service.refreshSettings(build(0.1));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.1));
service.refreshSettings(build(0.0));
assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.0));
}
}