Skip to content

Conversation

idegtiarenko
Copy link
Contributor

This replaces test usage of routingTable() with a project aware one.

@idegtiarenko idegtiarenko requested a review from nielsbauman July 10, 2025 11:55
@idegtiarenko idegtiarenko added >test Issues or PRs that are addressing/adding tests Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.2.0 labels Jul 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

.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.

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

Apologies for the late review, I was on PTO last week. Thanks for pinging me and for picking this up!

.shard(0)
.primaryShard()
.currentNodeId();
var projectState = TestProjectResolvers.DEFAULT_PROJECT_ONLY.getProjectState(clusterService().state());
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.

@idegtiarenko idegtiarenko requested a review from nielsbauman July 15, 2025 07:44
@nielsbauman
Copy link
Contributor

@idegtiarenko I see you requested my review, but I don't see any commits other than merging main. Was that intentional?

@idegtiarenko
Copy link
Contributor Author

@idegtiarenko I see you requested my review, but I don't see any commits other than merging main. Was that intentional?

I forgot to push my changes 🤦

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @idegtiarenko!

FWIW, I'm currently holding off on replacing deprecated calls like these in integration tests, as we might have to change them again when/if we allow running integration tests in multi-project mode. Just to avoid (potentially) wasting effort. But I'm all good with merging this PR as you've already done the effort :)

@idegtiarenko
Copy link
Contributor Author

@nielsbauman thanks!

@idegtiarenko idegtiarenko merged commit 1832248 into elastic:main Jul 16, 2025
34 checks passed
@idegtiarenko idegtiarenko deleted the replace_deprecated_routing_call branch July 16, 2025 13:39
szybia added a commit to szybia/elasticsearch that referenced this pull request Jul 16, 2025
…king * upstream/main: (91 commits) Mute org.elasticsearch.packaging.test.DockerTests test130JavaHasCorrectOwnership elastic#131369 Add exception logging when interrupted (elastic#131153) Mute org.elasticsearch.packaging.test.DockerTests test140CgroupOsStatsAreAvailable elastic#131372 Mute org.elasticsearch.packaging.test.DockerTests test070BindMountCustomPathConfAndJvmOptions elastic#131366 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=ml/delete_expired_data/Test delete expired data with body parameters} elastic#131364 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testSimilarityBetweenConstantVectorAndField {functionName=v_cosine similarityFunction=COSINE} elastic#131363 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testDifferentDimensions {functionName=v_cosine similarityFunction=COSINE} elastic#131362 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testSimilarityBetweenConstantVectors {functionName=v_cosine similarityFunction=COSINE} elastic#131361 Check SCORE_FUNCTION capability in VerifierTests (elastic#131352) Replace deprecated routingTable table call in tests (elastic#131005) [DOCS] Remove misused applies_to tag (elastic#131349) Adj ivf postings list building (elastic#130843) [Transform] Read metadata from Project State (elastic#131205) Add note on o11y to architecture guide (elastic#131291) Upgrade AWS Java SDK to 2.31.78 (elastic#131050) Support Fields API in conditional ingest processors (elastic#121914) ESQL - KNN function uses prefilters when pushed down to Lucene (elastic#131004) Add docs for ES|QL query logs (elastic#131287) Simplify `expectedFinalRegisterValue` computation (elastic#131274) Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search/110_field_collapsing/field collapsing, inner_hits and maxConcurrentGroupRequests} elastic#131348 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v9.2.0

3 participants