Describe the bug
AssertionUtils.assertFileContent compares a file against expected lines by zipping the two iterators:
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.
Describe the bug
AssertionUtils.assertFileContentcompares a file against expected lines by zipping the two iterators:fileLinesIter.zipWithIndex.zip(expectedLinesIter) .foreach { case ((lineInFile, lineIndex), expectedLine) => ... }zipstops at the shorter side, so any file line beyond the expected content is never compared. The length check that follows compares the expected count againstfileLineCount, butfileLineCountonly ever reaches the number of pairszipproduced, 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.assertFileContentalso backsassertFileContentSortedand 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.