smiklosovic commented on code in PR #2983:
URL: https://github.com/apache/cassandra/pull/2983#discussion_r1431306327
##########
test/unit/org/apache/cassandra/service/StartupChecksTest.java:
##########
@@ -204,6 +229,104 @@ List<TableGCPeriod> getTablesGcPeriods(String
userKeyspace)
verifyFailure(startupChecks, "Invalid tables: abc.def");
}
+ private <R> void withPathOverriddingFileSystem(Map<String, String>
pathOverrides, Callable<? extends R> callable) throws Exception
+ {
+ Map<String, FileStore> fileStores =
Set.copyOf(pathOverrides.values()).stream().collect(Collectors.toMap(s -> s, s
-> {
+ FileStore fs = mock(FileStore.class);
+ when(fs.type()).thenReturn(s);
+ return fs;
+ }));
+ FileSystem savedFileSystem = File.unsafeGetFilesystem();
+ try
+ {
+ ForwardingFileSystemProvider fsp = new
ForwardingFileSystemProvider(savedFileSystem.provider())
+ {
+ @Override
+ public FileStore getFileStore(Path path) throws IOException
+ {
+ String override = pathOverrides.get(path.toString());
+ if (override != null)
+ return fileStores.get(override);
+
+ return super.getFileStore(path);
+ }
+ };
+
+ ForwardingFileSystem fs = new
ForwardingFileSystem(File.unsafeGetFilesystem())
+ {
+ private final FileSystem thisFileSystem = this;
+
+ @Override
+ public FileSystemProvider provider()
+ {
+ return fsp;
+ }
+
+ @Override
+ protected Path wrap(Path p)
+ {
+ return new ForwardingPath(p)
+ {
+ @Override
+ public FileSystem getFileSystem()
+ {
+ return thisFileSystem;
+ }
+ };
+ }
+ };
+ File.unsafeSetFilesystem(fs);
+ callable.call();
+ }
+ finally
+ {
+ File.unsafeSetFilesystem(savedFileSystem);
+ }
+ }
+
+ public void testKernelBug1057843Check(String fsType, DiskAccessMode
diskAccessMode, Semver kernelVersion, boolean expectToFail) throws Exception
Review Comment:
@jacek-lewandowski might be private
--
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]