MINOR: make sure all generated data tests cover all versions#10078
Merged
Conversation
Merged
3 tasks
chia7712
commented
Mar 3, 2021
| public List<Short> allVersions() { | ||
| List<Short> versions = new ArrayList<>(latestVersion() - oldestVersion() + 1); | ||
| for (short version = oldestVersion(); version < latestVersion(); version++) { | ||
| for (short version = oldestVersion(); version <= latestVersion(); version++) { |
Member
Author
There was a problem hiding this comment.
This is not a critical bug as the method allVersions is used by testing only.
dajac
reviewed
Mar 4, 2021
dajac
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR. I have left few comments.
| private static <T extends Throwable> void assertThrowsInvalidRecordExceptionForAllVersions(ProduceRequest.Builder builder, | ||
| Class<T> expectedType) { | ||
| for (short version = builder.oldestAllowedVersion(); version <= builder.latestAllowedVersion(); version++) { | ||
| short v = version; |
Member
There was a problem hiding this comment.
Could we get rid of v and use version below directly?
Member
Author
There was a problem hiding this comment.
It requires final variable. I rewrite code by lambda foreach to eliminate duplicate intermediate variable.
| testEquivalentMessageRoundTrip(version, requestData); | ||
| } else if (version >= 2 && version <= 4) { | ||
| testAllMessageRoundTripsBetweenVersions(version, (short) 4, requestData, requestData); | ||
| testAllMessageRoundTripsBetweenVersions(version, (short) 5, requestData, requestData); |
Member
Author
There was a problem hiding this comment.
testAllMessageRoundTripsBetweenVersions exclude the end number so it should pass 5 so as to test version 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
inspired by #10068
Committer Checklist (excluded from commit message)