Skip to content

Commit

Permalink
Don't generate invalid combination of subobjects parameter in logsdb …
Browse files Browse the repository at this point in the history
…tests (#114265)
  • Loading branch information
lkts authored Oct 8, 2024
1 parent 3a83fcd commit 965265a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ tests:
- class: org.elasticsearch.xpack.inference.services.openai.OpenAiServiceTests
method: testInfer_StreamRequest
issue: https://github.com/elastic/elasticsearch/issues/114232
- class: org.elasticsearch.logsdb.datageneration.DataGeneratorTests
method: testDataGeneratorProducesValidMappingAndDocument
issue: https://github.com/elastic/elasticsearch/issues/114188
- class: org.elasticsearch.ingest.geoip.IpinfoIpDataLookupsTests
issue: https://github.com/elastic/elasticsearch/issues/114266
- class: org.elasticsearch.index.SearchSlowLogTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,12 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ
// TODO enable subobjects: auto
// It is disabled because it currently does not have auto flattening and that results in asserts being triggered when using
// copy_to.
if (ESTestCase.randomBoolean()) {
parameters.put(
"subobjects",
ESTestCase.randomValueOtherThan(
ObjectMapper.Subobjects.AUTO,
() -> ESTestCase.randomFrom(ObjectMapper.Subobjects.values())
).toString()
);
}
var subobjects = ESTestCase.randomValueOtherThan(
ObjectMapper.Subobjects.AUTO,
() -> ESTestCase.randomFrom(ObjectMapper.Subobjects.values())
);

if (request.parentSubobjects() == ObjectMapper.Subobjects.DISABLED
|| parameters.getOrDefault("subobjects", "true").equals("false")) {
if (request.parentSubobjects() == ObjectMapper.Subobjects.DISABLED || subobjects == ObjectMapper.Subobjects.DISABLED) {
// "enabled: false" is not compatible with subobjects: false
// changing "dynamic" from parent context is not compatible with subobjects: false
// changing subobjects value is not compatible with subobjects: false
Expand All @@ -124,6 +118,9 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ
return parameters;
}

if (ESTestCase.randomBoolean()) {
parameters.put("subobjects", subobjects.toString());
}
if (ESTestCase.randomBoolean()) {
parameters.put("dynamic", ESTestCase.randomFrom("true", "false", "strict", "runtime"));
}
Expand Down

0 comments on commit 965265a

Please sign in to comment.