Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.project.TestProjectResolvers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.compute.operator.exchange.ExchangeService;
Expand Down Expand Up @@ -131,12 +132,9 @@ public void testRetryOnShardMovement() {
(handler, request, channel, task) -> {
// move index shard
if (shouldMove.compareAndSet(true, false)) {
var currentShardNodeId = clusterService().state()
.routingTable()
.index("index-1")
.shard(0)
.primaryShard()
.currentNodeId();
var projectState = TestProjectResolvers.DEFAULT_PROJECT_ONLY.getProjectState(clusterService().state());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nielsbauman, I believe we do not run out integration tests with multi-project set up, but please let me know if there is a better way to replace this call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we do not run out integration tests with multi-project set up

Yep, that's exactly right. We've talked about adding test infrastructure for running integration tests with multiple projects, but we haven't decided/started on that yet.

My suggestion would be to do:

var shardRouting = clusterService().state().routingTable(ProjectId.DEFAULT).shardRoutingTable("index-1", 0);

That avoids the unnecessary conversion to ProjectState and it avoids the dependency on the project resolver. I hope that makes sense. Let me know if you have concerns or questions.

var shardRouting = projectState.routingTable().shardRoutingTable("index-1", 0);
var currentShardNodeId = shardRouting.primaryShard().currentNodeId();
assertAcked(
client().admin()
.indices()
Expand Down