Skip to content
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

Remove explicit SearchResponse references from spatial module test code #101196

Merged
merged 5 commits into from
Oct 23, 2023

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Oct 23, 2023

This PR adds new ElasticsearchAssertions#assertRespose methods that take a consumer for further inspection of the response. I refactor the ElasticsearchAssertions so all methods are calling this new method so there is only a few places where we call #decRef().

# Conflicts:
#	test/framework/src/main/java/org/elasticsearch/search/aggregations/metrics/CentroidAggregationTestBase.java
#	test/framework/src/main/java/org/elasticsearch/search/aggregations/metrics/SpatialBoundsAggregationTestBase.java
#	test/framework/src/main/java/org/elasticsearch/search/geo/BaseShapeIntegTestCase.java
#	test/framework/src/main/java/org/elasticsearch/search/geo/GeoBoundingBoxQueryIntegTestCase.java
#	x-pack/plugin/spatial/src/internalClusterTest/java/org/elasticsearch/xpack/spatial/search/GeoGridAggAndQueryConsistencyIT.java
#	x-pack/plugin/spatial/src/internalClusterTest/java/org/elasticsearch/xpack/spatial/search/GeoShapeWithDocValuesIT.java
#	x-pack/plugin/spatial/src/internalClusterTest/java/org/elasticsearch/xpack/spatial/search/LegacyGeoShapeWithDocValuesIT.java
@iverase iverase added >test Issues or PRs that are addressing/adding tests :Search/Search Search-related issues that do not fall into other categories v8.12.0 labels Oct 23, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Oct 23, 2023
Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM I think this is a fine approach, I was hoping we could mostly do without this kind of change but lets add it now and dry up usages later if we can I'd say :)

assertNoFailuresAndResponse(searchRequestBuilder, r -> {});
}

public static void assertNoFailuresAndResponse(SearchRequestBuilder searchRequestBuilder, Consumer<SearchResponse> consumer) {
Copy link
Member

Choose a reason for hiding this comment

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

If we're doing this (and I think it's fine) let's do a CheckedConsumer here and allow any exception maybe? Otherwise the code might get even more verbose if we have to deal with anything that throws checked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure adding a CheckedConsumer here as it will have huge effect everywhere. I hope we will understand what we need here as we add more cases so I would prefer to keep it simple until we know better what we need.

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, sorry just waking up fully seemingly :D We can change that later if need be ... my 🧠 thought we couldn't earlier :)

@iverase iverase merged commit ea430ec into elastic:main Oct 23, 2023
12 checks passed
@iverase iverase deleted the spatialAsserts branch October 23, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team >test Issues or PRs that are addressing/adding tests v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants