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

Dry up testChunking #92530

Merged

Conversation

DaveCTurner
Copy link
Contributor

Most chunking implementations have a corresponding test regarding the number of chunks emitted, and they're all pretty much copies of each other. Extracting a test utility to capture this pattern is long overdue.

Relates #89838

Most chunking implementations have a corresponding test regarding the
number of chunks emitted, and they're all pretty much copies of each
other. Extracting a test utility to capture this pattern is long
overdue.

Relates elastic#89838
@DaveCTurner DaveCTurner added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Network Http and internode communication implementations v8.7.0 labels Dec 22, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Dec 22, 2022
@elasticsearchmachine
Copy link
Collaborator

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

.getStatsResponses()
.size() + 2
)
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This and couple of other tests are extending AbstractChunkedSerializingTestCase. In such cases test implementation looks identical except the function that calculates the chunk count. Is it worth moving testChunking into AbstractChunkedSerializingTestCase and adding a new abstract method to provide the chunk count for the test object? This way chunk count test would be enforced in all sub-classes instead of relying on remembering to add one

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 know what you mean, but AbstractChunkedSerializingTestCase (and indeed AbstractSerializationTestCase) derivatives are only appropriate for objects that we expect to be able to parse back from their XContent representations. That used to apply to many objects because of the HLRC, and there's still a load of legacy in this area, but these days it's less important and indeed almost all of these tests (including the one you link here) are not such tests. So in most cases I expect we still need an explicit test for chunk count.

This whole question probably deserves a bit more of an overhaul than would make sense in this PR.

@DaveCTurner DaveCTurner added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jan 3, 2023
@elasticsearchmachine elasticsearchmachine merged commit e7fbfa1 into elastic:main Jan 3, 2023
@DaveCTurner DaveCTurner deleted the 2022-12-22-dry-up-testChunking branch January 3, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Coordination/Network Http and internode communication implementations Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. >test Issues or PRs that are addressing/adding tests v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants