Skip to content

Commit 841e7a8

Browse files
kkrik-esgmjehovich
authored andcommitted
Gate tests using subobjects:auto on feature flag (elastic#135185)
`subobjects:auto` is guarded behind a feature flag, not enabled. elastic#132360 added tests without proper guarding. Fixes elastic#135134
1 parent 9497e30 commit 841e7a8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,24 +495,29 @@ public void testSubobjectsWithRootObjectMapperNamespaceValidator() throws Except
495495
}
496496
}
497497
}""";
498+
499+
final String[] validSubojectsValues = ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG
500+
? new String[] { "false", "true", "auto" }
501+
: new String[] { "false", "true" };
502+
498503
{
499504
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", "false").replace("<FIELD_NAME>", "_project");
500505
Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperServiceWithNamespaceValidator(json, validator));
501506
assertThat(e.getMessage(), equalTo(errorMessage));
502507
}
503508
{
504-
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", randomFrom("true", "auto")).replace("<FIELD_NAME>", "_project");
509+
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", "true").replace("<FIELD_NAME>", "_project");
505510
Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperServiceWithNamespaceValidator(json, validator));
506511
assertThat(e.getMessage(), equalTo(errorMessage));
507512
}
508513
{
509-
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", randomFrom("false", "true", "auto"))
514+
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", randomFrom(validSubojectsValues))
510515
.replace("<FIELD_NAME>", "_project.foo");
511516
Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperServiceWithNamespaceValidator(json, validator));
512517
assertThat(e.getMessage(), equalTo(errorMessage));
513518
}
514519
{
515-
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", randomFrom("false", "true", "auto"))
520+
String json = withSubobjects.replace("<SUBOBJECTS_SETTING>", randomFrom(validSubojectsValues))
516521
.replace("<FIELD_NAME>", "project.foo");
517522
MapperService mapperService = createMapperServiceWithNamespaceValidator(json, validator);
518523
assertNotNull(mapperService);

0 commit comments

Comments
 (0)