Skip to content

Commit 82caa2b

Browse files
authored
Merge branch 'main' into refactor-xpack-async-search-tests
2 parents 9a71707 + 2ed5fd0 commit 82caa2b

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

muted-tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,6 @@ tests:
314314
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
315315
method: test {p0=transform/transforms_start_stop/Test start/stop/start continuous transform}
316316
issue: https://github.com/elastic/elasticsearch/issues/126755
317-
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
318-
method: testBeforeShardLockDuringShardCreate
319-
issue: https://github.com/elastic/elasticsearch/issues/126812
320-
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
321-
method: testLookUpSearchContext
322-
issue: https://github.com/elastic/elasticsearch/issues/126813
323317
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
324318
method: test {p0=transform/transforms_stats/Test get multiple transform stats where one does not have a task}
325319
issue: https://github.com/elastic/elasticsearch/issues/126863
@@ -591,6 +585,9 @@ tests:
591585
- class: org.elasticsearch.xpack.esql.action.EnrichIT
592586
method: testFilterAfterEnrich
593587
issue: https://github.com/elastic/elasticsearch/issues/130827
588+
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
589+
method: test {p0=mtermvectors/10_basic/Tests catching other exceptions per item}
590+
issue: https://github.com/elastic/elasticsearch/issues/122414
594591

595592
# Examples:
596593
#

server/src/test/java/org/elasticsearch/search/SearchServiceSingleNodeTests.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.elasticsearch.action.support.WriteRequest;
4545
import org.elasticsearch.client.internal.Client;
4646
import org.elasticsearch.cluster.metadata.IndexMetadata;
47+
import org.elasticsearch.cluster.routing.RecoverySource;
4748
import org.elasticsearch.cluster.routing.ShardRouting;
4849
import org.elasticsearch.cluster.routing.ShardRoutingState;
4950
import org.elasticsearch.cluster.routing.TestShardRouting;
@@ -1255,8 +1256,22 @@ public void testBeforeShardLockDuringShardCreate() {
12551256
TestShardRouting.newShardRouting(
12561257
new ShardId(indexService.index(), 0),
12571258
randomAlphaOfLength(5),
1258-
randomBoolean(),
1259-
ShardRoutingState.INITIALIZING
1259+
true,
1260+
ShardRoutingState.INITIALIZING,
1261+
RecoverySource.EmptyStoreRecoverySource.INSTANCE
1262+
),
1263+
indexService.getIndexSettings().getSettings()
1264+
);
1265+
assertEquals(1, service.getActiveContexts());
1266+
1267+
boolean primary = randomBoolean();
1268+
service.beforeIndexShardCreated(
1269+
TestShardRouting.newShardRouting(
1270+
new ShardId(indexService.index(), 0),
1271+
randomAlphaOfLength(5),
1272+
primary,
1273+
ShardRoutingState.INITIALIZING,
1274+
primary ? RecoverySource.ExistingStoreRecoverySource.INSTANCE : RecoverySource.PeerRecoverySource.INSTANCE
12601275
),
12611276
indexService.getIndexSettings().getSettings()
12621277
);

test/framework/src/main/java/org/elasticsearch/cluster/routing/TestShardRouting.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId
131131
return newShardRouting(shardId, currentNodeId, primary, state, ShardRouting.Role.DEFAULT);
132132
}
133133

134+
public static ShardRouting newShardRouting(
135+
ShardId shardId,
136+
String currentNodeId,
137+
boolean primary,
138+
ShardRoutingState state,
139+
RecoverySource recoverySource
140+
) {
141+
return newShardRouting(shardId, currentNodeId, primary, state, recoverySource, ShardRouting.Role.DEFAULT);
142+
}
143+
134144
public static ShardRouting newShardRouting(
135145
ShardId shardId,
136146
String currentNodeId,
@@ -154,6 +164,30 @@ public static ShardRouting newShardRouting(
154164
);
155165
}
156166

167+
public static ShardRouting newShardRouting(
168+
ShardId shardId,
169+
String currentNodeId,
170+
boolean primary,
171+
ShardRoutingState state,
172+
RecoverySource recoverySource,
173+
ShardRouting.Role role
174+
) {
175+
assertNotEquals(ShardRoutingState.RELOCATING, state);
176+
return new ShardRouting(
177+
shardId,
178+
currentNodeId,
179+
null,
180+
primary,
181+
state,
182+
recoverySource,
183+
buildUnassignedInfo(state),
184+
buildRelocationFailureInfo(state),
185+
buildAllocationId(state),
186+
ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE,
187+
role
188+
);
189+
}
190+
157191
public static ShardRouting newShardRouting(
158192
String index,
159193
int shardId,

0 commit comments

Comments
 (0)