Fix two windows-latest test flakes: TestNPOI1469 rounding and POIDataSamples.GetFile sharing mode - #1867
Merged
tonyqus merged 2 commits intoSep 12, 2026
Conversation
DateTime.UtcNow has sub-second precision. ToString("HH:mm:ss") truncates
(e.g., 16:56:17.987 -> "16:56:17"), but DataFormatter rounds the Excel
OLE date double, producing "16:56:18". Truncate to whole seconds before
the test starts so both paths agree.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a479c13)
…GetFile GetFile opened test-data files with FileMode.OpenOrCreate, which means FileAccess.ReadWrite and FileShare.Read. While TestHSSFWorkbook held SampleSS.xls that way, any concurrent reader in the other test host was refused with "The process cannot access the file ... because it is being used by another process", and the net472 and net10.0 hosts run in parallel under Nuke. TestDetectAsPOIFS failed this way on windows-latest for #5 (first attempt); the re-run passed. No caller writes through this handle: the only Write() that follows one is asserted to throw on a read-only filesystem, and the WriteFileSystem calls in TestNPOIFSFileSystem target temp files. Opening read-only with FileShare.ReadWrite removes the race without changing any test's behaviour. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 66dd377)
Contributor
Author
|
One more data point for the That test also goes through (Comment by Claude, an AI assistant, on Ken's behalf.) |
Member
|
LGTM |
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.
windows-lateston master has been red on its last two pushes (runs 33473168767 on 2026-09-01 and 34364474895 on 2026-09-09) for a single test each time,TestNPOI1469, and a fork of this repo hit a second single-test failure on the same job. Both are test-infrastructure races, not library bugs. This PR fixes both. Every other test in those runs passed on both TFMs, so with these two changes the Windows job should go green.1.
TestNPOI1469("Row mismatch (0)",testcases/main/HSSF/UserModel/TestCellStyle.cs)The test formats its start time with
ToString("HH:mm:ss"), which truncates, and compares againstDataFormatter, which rounds the Excel OLE-date double. WheneverDateTime.UtcNowlands in the upper half of a second the two disagree by one second. Truncating the start time to whole seconds makes both paths agree. This fix has been running in the swyfft-insurance fork since July with no recurrence.2.
TestDetectAsPOIFS(IOException: SampleSS.xls ... being used by another process)POIDataSamples.GetFile()opens sample files withFileMode.OpenOrCreate, which meansFileAccess.ReadWriteplusFileShare.Read. Nuke runs the net472 and net10.0 test hosts in parallel, so whileTestHSSFWorkbook.CloseDoesNotModifyWorkbookholdsSampleSS.xlsthrough that handle, the other host'sConfirmIsPOIFSreader is refused. Linux has no such sharing rule, which is whyubuntu-latestnever sees it. No caller writes through this handle: the oneWrite()that follows it is asserted to throw on a read-only filesystem, and theWriteFileSystem()calls inTestNPOIFSFileSystemtarget temp files. Opening read-only withFileShare.ReadWriteremoves the race without changing any test's behaviour. Seen on swyfft-insurance/npoi run 34372163455 (attempt 1); the re-run of the same commit passed.Verified locally on this branch:
NPOI.TestCasesbuilds on net10.0, andTestNPOI1469,TestOfficeXMLException, andCloseDoesNotModifyWorkbookpass. Both changes are confined totestcases/main.(PR opened by Claude, an AI assistant, on Ken's behalf.)