LuciferYang opened a new pull request, #7730: URL: https://github.com/apache/kyuubi/pull/7730
### Why are the changes needed? Closes #7729. `AssertionUtils.assertFileContent` compares a file against expected lines with `fileLinesIter.zipWithIndex.zip(expectedLinesIter)`. `zip` stops at the shorter side, so file lines beyond the expected content were never compared, and `fileLineCount` only ever reached the number of pairs `zip` produced. The length check `assertResult(expectedLinesIter.size)(fileLineCount)` therefore passed whenever the file was longer, so a golden file with stale trailing lines went unnoticed. This drains the remaining file lines into `fileLineCount` after the comparison, so the length check sees the file's true length and fails when the file is longer than expected. The equal-length and shorter-file cases are unchanged. Consumers regenerate their golden files from the same source they compare against (`verifyOrRegenerateGoldenFile` writes `toMarkdown` and reads it back), so a correctly regenerated file still round-trips to the same length. ### How was this patch tested? Added `AssertionUtilsSuite` (the module's first self-test for the assertion helpers): a trailing-extra-line case that must throw `TestFailedException` with the "Line number is not expected" clue, and an exact-content case that must pass. The trailing case stops failing if the drain loop is reverted. ``` build/mvn test -pl kyuubi-util-scala -am build/mvn scalastyle:check spotless:check -pl kyuubi-util-scala -am ``` Module green on Zulu 17.0.18 (23/23), scalastyle 0 errors, spotless clean. ### Was this patch assisted by generative AI tooling? Assisted-by: Claude Opus 4.8 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
