Skip to content

Commit

Permalink
Fixing test failure due to inferred index version (#101984)
Browse files Browse the repository at this point in the history
Does what it says on the tin.

closes: #101964
  • Loading branch information
benwtrent authored Nov 10, 2023
1 parent fce89cb commit 7a3ae72
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.action.search;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsGroup;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
import org.elasticsearch.cluster.node.DiscoveryNode;
Expand All @@ -23,14 +24,14 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.util.iterable.Iterables;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.query.RandomQueryBuilder;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.internal.AliasFilter;
import org.elasticsearch.test.AbstractWireSerializingTestCase;
import org.elasticsearch.test.TransportVersionUtils;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -39,6 +40,7 @@
import java.util.List;
import java.util.Map;

import static org.elasticsearch.test.VersionUtils.randomCompatibleVersion;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;

Expand Down Expand Up @@ -109,16 +111,14 @@ protected SearchShardsResponse mutateInstance(SearchShardsResponse r) throws IOE
}

public void testLegacyResponse() {
DiscoveryNode node1 = DiscoveryNodeUtils.create(
"node-1",
new TransportAddress(TransportAddress.META_ADDRESS, randomInt(0xFFFF)),
VersionUtils.randomVersion(random())
);
DiscoveryNode node2 = DiscoveryNodeUtils.create(
"node-2",
new TransportAddress(TransportAddress.META_ADDRESS, randomInt(0xFFFF)),
VersionUtils.randomVersion(random())
);
DiscoveryNode node1 = DiscoveryNodeUtils.builder("node-1")
.address(new TransportAddress(TransportAddress.META_ADDRESS, randomInt(0xFFFF)))
.version(randomCompatibleVersion(random(), Version.CURRENT), IndexVersion.MINIMUM_COMPATIBLE, IndexVersion.current())
.build();
DiscoveryNode node2 = DiscoveryNodeUtils.builder("node-2")
.address(new TransportAddress(TransportAddress.META_ADDRESS, randomInt(0xFFFF)))
.version(randomCompatibleVersion(random(), Version.CURRENT), IndexVersion.MINIMUM_COMPATIBLE, IndexVersion.current())
.build();
final ClusterSearchShardsGroup[] groups = new ClusterSearchShardsGroup[2];
{
ShardId shardId = new ShardId("index-1", "uuid-1", 0);
Expand Down

0 comments on commit 7a3ae72

Please sign in to comment.