[Test] Remove duplicate method in TestShardRouting (#32815)

This commit is contained in:
Tanguy Leroux 2018-09-10 18:29:00 +02:00 committed by GitHub
parent 74d41857c6
commit 079d130d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 16 additions and 19 deletions

View File

@ -66,7 +66,7 @@ class BuildPlugin implements Plugin<Project> {
void apply(Project project) {
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
throw new InvalidUserDataException('elasticsearch.standalone-test, '
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
+ 'elasticearch.standalone-rest-test, and elasticsearch.build '
+ 'are mutually exclusive')
}
final String minimumGradleVersion

View File

@ -63,7 +63,7 @@ class PrecommitTasks {
* (which provides NamingConventionsCheck) and :test:logger-usage
* which provides the logger usage check. Since the build tools
* don't use the logger usage check because they don't have any
* of Elasticsearch's loggers and :test:logger-usage actually does
* of Elaticsearch's loggers and :test:logger-usage actually does
* use the NamingConventionsCheck we break the circular dependency
* here.
*/

View File

@ -11,7 +11,7 @@ cluster where {xpack} is installed, then you must download and configure the
. Add the {xpack} transport JAR file to your *CLASSPATH*. You can download the {xpack}
distribution and extract the JAR file manually or you can get it from the
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearch Maven repository].
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearc Maven repository].
As with any dependency, you will also need its transitive dependencies. Refer to the
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.pom[X-Pack POM file
for your version] when downloading for offline usage.

View File

@ -2,7 +2,7 @@
================================================
When you extract the zip or tarball packages, the `elasticsearch-n.n.n`
directory contains the Elasticsearch `config`, `data`, `logs` and
directory contains the Elasticsearh `config`, `data`, `logs` and
`plugins` directories.
We recommend moving these directories out of the Elasticsearch directory

View File

@ -71,7 +71,7 @@ thirdPartyAudit.excludes = [
'org.apache.log.Logger',
]
// Support for testing reindex-from-remote against old Elasticsearch versions
// Support for testing reindex-from-remote against old Elaticsearch versions
configurations {
oldesFixture
es2

View File

@ -134,8 +134,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
ResizeAllocationDecider resizeAllocationDecider = new ResizeAllocationDecider(Settings.EMPTY);
RoutingAllocation routingAllocation = new RoutingAllocation(null, null, clusterState, null, 0);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
routingAllocation));
@ -164,8 +164,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
int shardId = randomIntBetween(0, 3);
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
routingAllocation));
@ -204,8 +204,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
int shardId = randomIntBetween(0, 3);
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.YES, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
String allowedNode = clusterState.getRoutingTable().index("source").shard(sourceShardId).primaryShard().currentNodeId();

View File

@ -1200,7 +1200,8 @@ public class IndexShardTests extends IndexShardTestCase {
public void testShardStatsWithFailures() throws IOException {
allowShardFailures();
final ShardId shardId = new ShardId("index", "_na_", 0);
final ShardRouting shardRouting = newShardRouting(shardId, "node", true, RecoverySource.EmptyStoreRecoverySource.INSTANCE, ShardRoutingState.INITIALIZING);
final ShardRouting shardRouting =
newShardRouting(shardId, "node", true, ShardRoutingState.INITIALIZING, RecoverySource.EmptyStoreRecoverySource.INSTANCE);
final NodeEnvironment.NodePath nodePath = new NodeEnvironment.NodePath(createTempDir());

View File

@ -39,10 +39,6 @@ public class TestShardRouting {
return newShardRouting(new ShardId(index, IndexMetaData.INDEX_UUID_NA_VALUE, shardId), currentNodeId, primary, state);
}
public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, RecoverySource recoverySource, ShardRoutingState state) {
return new ShardRouting(shardId, currentNodeId, null, primary, state, recoverySource, buildUnassignedInfo(state), buildAllocationId(state), -1);
}
public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, ShardRoutingState state) {
return new ShardRouting(shardId, currentNodeId, null, primary, state, buildRecoveryTarget(primary, state), buildUnassignedInfo(state), buildAllocationId(state), -1);
}

View File

@ -726,7 +726,7 @@ public abstract class IndexShardTestCase extends ESTestCase {
final IndexId indexId = new IndexId(shardId.getIndex().getName(), shardId.getIndex().getUUID());
final DiscoveryNode node = getFakeDiscoNode(shard.routingEntry().currentNodeId());
final RecoverySource.SnapshotRecoverySource recoverySource = new RecoverySource.SnapshotRecoverySource(snapshot, version, index);
final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, recoverySource, ShardRoutingState.INITIALIZING);
final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, ShardRoutingState.INITIALIZING, recoverySource);
shard.markAsRecovering("from snapshot", new RecoveryState(shardRouting, node, null));
repository.restoreShard(shard, snapshot.getSnapshotId(), version, indexId, shard.shardId(), shard.recoveryState());

View File

@ -49,7 +49,7 @@ initial payload.
A <<input-search, search>> input contains a `request` object that specifies the
indices you want to search, the {ref}/search-request-search-type.html[search type],
and the search request body. The `body` field of a search input is the same as
the body of an Elasticsearch `_search` request, making the full Elasticsearch
the body of an Elasticsearch `_search` request, making the full Elaticsearch
Query DSL available for you to use.
For example, the following `search` input loads the latest VIX quote:

View File

@ -5,7 +5,7 @@
#
# meta-foo.zip <-- zip file for the meta plugin, with this structure:
#|____elasticsearch/
#| |____ <bundled_plugin_1> <-- The plugin files for bundled_plugin_1 (the content of the elasticsearch directory)
#| |____ <bundled_plugin_1> <-- The plugin files for bundled_plugin_1 (the content of the elastisearch directory)
#| |____ <bundled_plugin_2> <-- The plugin files for bundled_plugin_2
#| |____ meta-plugin-descriptor.properties <-- example contents below:
#