[TEST] Fix FileSettingsRoleMappingsStartupIT#92653
Conversation
Disable mock lucene file systems that throw an error where IOException is expected.
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Sounds sensible. Is there an alternative mock file system we could use instead, or some way to modify the lucene one to throw the right sort of exception? |
I looked at various options in |
|
Ideally we would have a mock file system that acted the same as the real file system, so we don't pollute the real FS with files. But if that doesn't exist, then using the real FS is ok. |
|
Thanks Simon! |
💔 Backport failed
You can use sqren/backport to manually backport by running |
Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (#91863), plus addressed a related issue around mock windows file-systems misbehaving (#92653). This PR extends the above fixes to all file-settings related ITs.
…6392) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (elastic#91863), plus addressed a related issue around mock windows file-systems misbehaving (elastic#92653). This PR extends the above fixes to all file-settings related ITs. (cherry picked from commit 91559da)
…6392) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (elastic#91863), plus addressed a related issue around mock windows file-systems misbehaving (elastic#92653). This PR extends the above fixes to all file-settings related ITs. (cherry picked from commit 91559da)
Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (#91863), plus addressed a related issue around mock windows file-systems misbehaving (#92653). This PR extends the above fixes to all file-settings related ITs.
…116709) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (#91863), plus addressed a related issue around mock windows file-systems misbehaving (#92653). This PR extends the above fixes to all file-settings related ITs. (cherry picked from commit 91559da)
…116710) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (#91863), plus addressed a related issue around mock windows file-systems misbehaving (#92653). This PR extends the above fixes to all file-settings related ITs. (cherry picked from commit 91559da) Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…6392) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (elastic#91863), plus addressed a related issue around mock windows file-systems misbehaving (elastic#92653). This PR extends the above fixes to all file-settings related ITs.
…6392) Several file-settings ITs fail (rarely) with exceptions like: ``` java.nio.file.AccessDeniedException: C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempFile-001.tmp -> C:\Users\jenkins\workspace\platform-support\14\server\build\testrun\internalClusterTest\temp\org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT_5733F2A737542BE-001\tempDir-002\config\operator\settings.json | at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) | -- | -- | | at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) | | | at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317) | | | at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at org.apache.lucene.tests.mockfile.FilterFileSystemProvider.move(FilterFileSystemProvider.java:144) | | | at java.nio.file.Files.move(Files.java:1430) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.writeJSONFile(SnaphotsAndFileSettingsIT.java:86) | | | at org.elasticsearch.reservedstate.service.SnaphotsAndFileSettingsIT.testRestoreWithPersistedFileSettings(SnaphotsAndFileSettingsIT.java:321) ``` This happens in Windows file systems, due to a race condition where the file settings service is reading the settings file concurrently with the test trying to modify it (a no-go in Windows). It turns out we have already addressed this with a retry for one test suite (elastic#91863), plus addressed a related issue around mock windows file-systems misbehaving (elastic#92653). This PR extends the above fixes to all file-settings related ITs.
Disable mock lucene file systems that throw an error where IOException is expected.
FileSettingsService uses the Java WatchService to detect when the file settings have been modified. While processing the current file settings, the file can get replaced on the file system which might cause an IOException at various places when we are in the process of reading the file.
Throwing an IOException because of an overwritten file is harmless. We'll simply abandon the current file settings processing and we'll process the next event from the watcher service.
However, the mock file systems that we use by default from lucene turn this IOException into a j.l.AssertionError, which isn't an Exception but extends from j.l.Error. Since we only handle Exceptions in the catch block, the Error is propagated all the way to the watcher thread and effectively the file settings service thread terminates.
With this PR I'm disabling the mock file systems, we should be testing the actual file system functionality. If this PR fixes the issue, I'll apply the same fix to the other similar FileSettingsService tests.
Closes #92242