Skip to content

Add new base test case for chunked xcontent types #90707

Merged
original-brownbear merged 5 commits intoelastic:mainfrom
original-brownbear:just-test-changes
Oct 6, 2022
Merged

Add new base test case for chunked xcontent types #90707
original-brownbear merged 5 commits intoelastic:mainfrom
original-brownbear:just-test-changes

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

Extracted only test changes for moving to a new base test class from #90409 (+ one utility in prod code).

Making sure that none of the chunked implementations also implement
`toXContent`. Added some utilities for working with chunked xcontent
that mirror xcontent utilities to keep the changeset as quiet as possible.
No big production code changes here, this mostly affects test code paths.
@original-brownbear original-brownbear added >test Issues or PRs that are addressing/adding tests :Distributed/Network Http and internode communication implementations v8.6.0 labels Oct 6, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Oct 6, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Copy Markdown
Contributor

@henningandersen henningandersen 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 do wonder if we could have done this as a more pure refactoring effort, would be simpler to review. But good to go...

import java.util.function.Predicate;

public class GetSettingsResponseTests extends AbstractSerializingTestCase<GetSettingsResponse> {
public class GetSettingsResponseTests extends AbstractChunkedSerializingTestCase<GetSettingsResponse> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if this (and other chunked tests) could have not used AbstractXContentSerializingTestCase in this PR instead and thus made this into a more pure refactoring PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea I had that same thought when extracting stuff. But in the end I figured I'd be merging dead code then because the chunked version wouldn't have been used anywhere which felt wrong in a different dimension.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we have left out the chunked version and just introduced the new abstract test class and the xcontent specific one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤦 right that would've made more sense. Sorry, was a little quick there.

@original-brownbear
Copy link
Copy Markdown
Contributor Author

Thanks Henning!

@original-brownbear original-brownbear merged commit aa7a8a0 into elastic:main Oct 6, 2022
@original-brownbear original-brownbear deleted the just-test-changes branch October 6, 2022 12:54
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Oct 10, 2022
* main: (150 commits)
  Remove ToXContent interface from ChunkedToXContent (elastic#90409)
  Remove extra SearchService constructor (elastic#90733)
  Update min version for the diagnosis yaml test (elastic#90731)
  Use the AggTestConfig object in testCase (elastic#90699)
  [DOCS] Add links to clear trained model deployment cache API (elastic#90727)
  Assert wildcards are not expanded as specified by request options  (elastic#90641)
  [TEST] Fix exit snapshot restore exit condition (elastic#90696)
  [TEST] Change to atomic file contents save (elastic#90695)
  Update forbiddenapis to 3.4 (elastic#90624)
  [Tests] Don't use concurrent search in scripted field type tests (elastic#90712)
  [ML] Move scaling is possible check for starting trained model (elastic#90706)
  Add new base test case for chunked xcontent types  (elastic#90707)
  Fix testRedNoBlockedIndicesAndRedAllRoleNodes (elastic#90671)
  Fix nullpointer in docs test setup (elastic#90660)
  Don't produce build logs artifact when in a composite build
  Fixing a race condition in EnrichCoordinatorProxyAction that can leave an item stuck in its queue (elastic#90688)
  docs: update fleet/agent pipeline docs (elastic#90659)
  [HealthAPI] Use plural consistently in resource types (elastic#90682)
  [Testing] Enable bwc and fix sorting for 500_date_range (elastic#90681)
  Add profiling and documentation for dfs phase (elastic#90536)
  ...

# Conflicts:
#	x-pack/plugin/mapper-aggregate-metric/src/test/java/org/elasticsearch/xpack/aggregatemetric/mapper/AggregateDoubleMetricFieldMapperTests.java
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Oct 11, 2022
in elastic#90707 a org.elasticsearch.test.AbstractSerializingTestCase was refactored and
AbstractXContentSerializingTestCase should be used instead.
pgomulka added a commit that referenced this pull request Oct 11, 2022
in #90707 a org.elasticsearch.test.AbstractSerializingTestCase was refactored and
AbstractXContentSerializingTestCase should be used instead.
@original-brownbear original-brownbear restored the just-test-changes branch November 30, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Network Http and internode communication implementations Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v8.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants