Skip to content

Commit 5cb72c4

Browse files
committed
Update the test for the stateless scenario
1 parent 21fa7f6 commit 5cb72c4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleShardPersistentTaskExecutorTests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,14 @@ public void testGetStatelessAssignment() {
144144
var searchNode = newNode(Set.of(DiscoveryNodeRole.SEARCH_ROLE));
145145
var indexNode = newNode(Set.of(DiscoveryNodeRole.INDEX_ROLE));
146146
var shardId = new ShardId(backingIndex, 0);
147+
ShardRouting indexOnlyShard = shardRoutingBuilder(shardId, indexNode.getId(), true, STARTED).withRecoverySource(null)
148+
.withRole(ShardRouting.Role.INDEX_ONLY)
149+
.build();
147150
var clusterState = ClusterState.builder(initialClusterState)
148151
.nodes(new DiscoveryNodes.Builder().add(indexNode).add(searchNode).build())
149152
.putRoutingTable(
150153
projectId,
151-
RoutingTable.builder()
152-
.add(
153-
IndexRoutingTable.builder(backingIndex)
154-
.addShard(shardRoutingBuilder(shardId, indexNode.getId(), true, STARTED).withRecoverySource(null).build())
155-
)
156-
.build()
154+
RoutingTable.builder().add(IndexRoutingTable.builder(backingIndex).addShard(indexOnlyShard)).build()
157155
)
158156
.build();
159157

@@ -177,7 +175,7 @@ public void testGetStatelessAssignment() {
177175
RoutingTable.builder()
178176
.add(
179177
IndexRoutingTable.builder(backingIndex)
180-
.addShard(shardRoutingBuilder(shardId, indexNode.getId(), true, STARTED).withRecoverySource(null).build())
178+
.addShard(indexOnlyShard)
181179
.addShard(
182180
shardRoutingBuilder(shardId, searchNode.getId(), false, STARTED).withRecoverySource(null)
183181
.withRole(ShardRouting.Role.SEARCH_ONLY)

0 commit comments

Comments
 (0)