Skip to content

Commit

Permalink
fix flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrik-es committed Oct 22, 2024
1 parent 93ccff2 commit df82d50
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testIndexCreation() throws Exception {
assertTrue(indexService.getIndexSettings().getSettings().hasValue("index.refresh_interval"));
assertEquals("100", indexService.getIndexSettings().getSettings().get("index.mapping.depth.limit"));

INDEX_SETTING_OVERRULING.set(false);
INDEX_SETTING_DEPTH_ENABLED.set(false);
INDEX_SETTING_PROVIDER2_ENABLED.set(true);
var e = expectThrows(IllegalArgumentException.class, () -> createIndex("my-index4", settings));
assertEquals(
Expand Down Expand Up @@ -71,6 +71,7 @@ public Collection<IndexSettingProvider> getAdditionalIndexSettingProviders(Index

private static final AtomicBoolean INDEX_SETTING_PROVIDER1_ENABLED = new AtomicBoolean(false);
private static final AtomicBoolean INDEX_SETTING_PROVIDER2_ENABLED = new AtomicBoolean(false);
private static final AtomicBoolean INDEX_SETTING_DEPTH_ENABLED = new AtomicBoolean(true);
private static final AtomicBoolean INDEX_SETTING_OVERRULING = new AtomicBoolean(false);

static class TestIndexSettingsProvider implements IndexSettingProvider {
Expand All @@ -94,7 +95,11 @@ public Settings getAdditionalIndexSettings(
List<CompressedXContent> combinedTemplateMappings
) {
if (enabled.get()) {
return Settings.builder().put("index.refresh_interval", intervalValue).put("index.mapping.depth.limit", 100).build();
var builder = Settings.builder().put("index.refresh_interval", intervalValue);
if (INDEX_SETTING_DEPTH_ENABLED.get()) {
builder.put("index.mapping.depth.limit", 100);
}
return builder.build();
} else {
return Settings.EMPTY;
}
Expand Down

0 comments on commit df82d50

Please sign in to comment.