Skip to content

Commit

Permalink
Broaden index versions tested in some mappings tests
Browse files Browse the repository at this point in the history
MINIMUM_READONLY_COMPATIBLE is used as a lower bound (N-2) as opposed to
MINIMUM_COMPATIBLE (N-1).
  • Loading branch information
javanna committed Dec 18, 2024
1 parent 9cc362b commit 8f9ec9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ public void testBlankFieldName() throws Exception {
}

public void testBlankFieldNameBefore8_6_0() throws Exception {
IndexVersion version = IndexVersionUtils.randomVersionBetween(random(), IndexVersions.MINIMUM_COMPATIBLE, IndexVersions.V_8_5_0);
IndexVersion version = IndexVersionUtils.randomVersionBetween(
random(),
IndexVersions.MINIMUM_READONLY_COMPATIBLE,
IndexVersions.V_8_5_0
);
TransportVersion transportVersion = TransportVersionUtils.randomVersionBetween(
random(),
TransportVersions.MINIMUM_COMPATIBLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.indices;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.mapper.DataStreamTimestampFieldMapper;
Expand Down Expand Up @@ -98,8 +97,6 @@ public Map<String, MetadataFieldMapper.TypeParser> getMetadataMappers() {
DataStreamTimestampFieldMapper.NAME,
FieldNamesFieldMapper.NAME };

@UpdateForV9(owner = UpdateForV9.Owner.SEARCH_FOUNDATIONS)
@AwaitsFix(bugUrl = "test is referencing 7.x index versions so needs to be updated for 9.0 bump")
public void testBuiltinMappers() {
IndicesModule module = new IndicesModule(Collections.emptyList());
{
Expand Down Expand Up @@ -239,14 +236,14 @@ public Map<String, MetadataFieldMapper.TypeParser> getMetadataMappers() {

public void testFieldNamesIsLast() {
IndicesModule module = new IndicesModule(Collections.emptyList());
IndexVersion version = IndexVersionUtils.randomVersionBetween(random(), IndexVersions.MINIMUM_COMPATIBLE, IndexVersion.current());
IndexVersion version = IndexVersionUtils.randomVersion();
List<String> fieldNames = new ArrayList<>(module.getMapperRegistry().getMetadataMapperParsers(version).keySet());
assertEquals(FieldNamesFieldMapper.NAME, fieldNames.get(fieldNames.size() - 1));
}

public void testFieldNamesIsLastWithPlugins() {
IndicesModule module = new IndicesModule(fakePlugins);
IndexVersion version = IndexVersionUtils.randomVersionBetween(random(), IndexVersions.MINIMUM_COMPATIBLE, IndexVersion.current());
IndexVersion version = IndexVersionUtils.randomVersion();
List<String> fieldNames = new ArrayList<>(module.getMapperRegistry().getMetadataMapperParsers(version).keySet());
assertEquals(FieldNamesFieldMapper.NAME, fieldNames.get(fieldNames.size() - 1));
}
Expand Down

0 comments on commit 8f9ec9b

Please sign in to comment.