LuciferYang opened a new issue, #7729:
URL: https://github.com/apache/kyuubi/issues/7729

   ### Describe the bug
   
   `AssertionUtils.assertFileContent` compares a file against expected lines by 
zipping the two iterators:
   
   ```scala
   fileLinesIter.zipWithIndex.zip(expectedLinesIter)
     .foreach { case ((lineInFile, lineIndex), expectedLine) => ... }
   ```
   
   `zip` stops at the shorter side, so any file line beyond the expected 
content is never compared. The length check that follows compares the expected 
count against `fileLineCount`, but `fileLineCount` only ever reaches the number 
of pairs `zip` produced, so it already equals the expected count whenever the 
file is longer. A golden file with stale trailing lines therefore passes even 
though it no longer matches what the test declares.
   
   `assertFileContent` also backs `assertFileContentSorted` and the 
SPI/golden-file checks, so a golden file that has gained extra trailing lines 
(a stale entry left behind after a deletion, say) is not caught.
   
   This runs against the intent of the line-count check added in #5275, which 
was meant to catch a golden file drifting out of sync with its source.
   
   ### Affects Version(s)
   
   master (1.13.0-SNAPSHOT), and earlier releases carrying `kyuubi-util-scala`.
   
   ### Are you willing to submit PR?
   
   Yes.
   


-- 
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]

Reply via email to