- Notifications
You must be signed in to change notification settings - Fork 25.5k
Replace deprecated routingTable table call in tests #131005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace deprecated routingTable table call in tests #131005
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
.shard(0) | ||
.primaryShard() | ||
.currentNodeId(); | ||
var projectState = TestProjectResolvers.DEFAULT_PROJECT_ONLY.getProjectState(clusterService().state()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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 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 🤦 |
There was a problem hiding this 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 :)
@nielsbauman thanks! |
…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 ...
This replaces test usage of
routingTable()
with a project aware one.