Core: Use mocks in TrackedFile tests#17133
Open
rdblue wants to merge 2 commits into
Open
Conversation
rdblue
commented
Jul 7, 2026
|
|
||
| /** Mutable {@link StructLike} implementation of {@link TrackedFile}. */ | ||
| class TrackedFileStruct extends SupportsIndexProjection implements TrackedFile, Serializable { | ||
| private static final Types.StructType EMPTY_STRUCT_TYPE = Types.StructType.of(); |
Contributor
Author
There was a problem hiding this comment.
This struct is still used in the BASE_TYPE just below.
stevenzwu
reviewed
Jul 7, 2026
gaborkaszab
reviewed
Jul 8, 2026
gaborkaszab
reviewed
Jul 8, 2026
gaborkaszab
reviewed
Jul 8, 2026
| // mutable fields are deep-copied, not shared with the original | ||
| assertThat(copy.tracking()).isNotSameAs(file.tracking()); | ||
| assertThat(copy.partition()).isNotSameAs(file.partition()); | ||
| assertThat(copy.deletionVector()).isNotSameAs(file.deletionVector()); |
Contributor
There was a problem hiding this comment.
Would it make sense to introduce mocks for the below nested fields too? Tracking and partition doesn't seem any special from this aspect.
Contributor
Author
There was a problem hiding this comment.
The issue with this is that we do not currently have copy methods for them. I think that we should follow up to do this.
Contributor
0f2d8c1 to
83d6309
Compare
stevenzwu
approved these changes
Jul 8, 2026
| assertThat(copy.partition()).isSameAs(PARTITION_COPY); | ||
|
|
||
| // mutable fields are deep-copied, not shared with the original | ||
| assertThat(copy.tracking()).isNotSameAs(file.tracking()); |
Contributor
There was a problem hiding this comment.
nit: it might make more sense to keep the two isSameAs assertions here to check they are deep copied and not shared with the original object, as the comment above described.
amogh-jahagirdar
approved these changes
Jul 8, 2026
anoopj
approved these changes
Jul 9, 2026
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.
This updates
TestTrackedFileStructto use mock objects for plumbing tests rather than creating instances ofTrackingStructandPartitionData.