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

[SPARK-50360][SS][FOLLOWUP][TESTS] Changelog reader test improvements #49272

Closed
wants to merge 1 commit into from

Conversation

WweiL
Copy link
Contributor

@WweiL WweiL commented Dec 23, 2024

What changes were proposed in this pull request?

In some test cases added by #48880, changelogReader.closeIfNeeded() is called before assert(entries.size == expectedEntries.size), while entries are defined as entries = changelogReader.toSeq, which triggers the read.

So the logic is

entries = changelogReader.toSeq
changelogReader.closeIfNeeded()
assert(entries.size == expectedEntries.size)

This is fine in most cases, but we find out that in certain environments, the toSeq is lazily evaluated; therefore, not until the assert, the actual read won't be triggered. To be extra safe, change the order of the above logic to be the following:

entries = changelogReader.toSeq
assert(entries.size == expectedEntries.size)
changelogReader.closeIfNeeded()

Why are the changes needed?

Test case improvement

Does this PR introduce any user-facing change?

No

How was this patch tested?

Test only change

Was this patch authored or co-authored using generative AI tooling?

No

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

+1

@HeartSaVioR
Copy link
Contributor

Thanks! Merging to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants