You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/24 13:00:07 UTC

[GitHub] [flink] aljoscha commented on a change in pull request #11891: [FLINK-17359] [flink-core] Fix for resolving entropy while using plugin filesystem

aljoscha commented on a change in pull request #11891:
URL: https://github.com/apache/flink/pull/11891#discussion_r414533705



##########
File path: flink-core/src/test/java/org/apache/flink/core/fs/EntropyInjectorTest.java
##########
@@ -160,6 +161,45 @@ public void testWithSafetyNet() throws Exception {
 		} catch (IOException ignored) {}
 	}
 
+	@Test
+	public void testClassLoaderFixingFs() throws Exception {
+		final String entropyKey = "__ekey__";
+		final String entropyValue = "abc";
+
+		final File folder = TMP_FOLDER.newFolder();
+
+		final Path path = new Path(Path.fromLocalFile(folder), entropyKey + "/path/");
+		final Path pathWithEntropy = new Path(Path.fromLocalFile(folder), entropyValue + "/path/");
+
+		PluginFileSystemFactory pluginFsFactory = PluginFileSystemFactory.of(
+				new TestFileSystemFactory(entropyKey, entropyValue));
+		FileSystem testFs = pluginFsFactory.create(URI.create("test"));
+
+		FSDataOutputStream out;
+
+		FileSystemSafetyNet.initializeSafetyNetForThread();
+		FileSystem fs = FileSystemSafetyNet.wrapWithSafetyNetWhenActivated(testFs);
+		try  {
+			OutputStreamAndPath streamAndPath = EntropyInjector.createEntropyAware(
+					fs, path, WriteMode.NO_OVERWRITE);
+
+			out = streamAndPath.stream();
+
+			assertEquals(pathWithEntropy, streamAndPath.path());
+		}
+		finally {
+			FileSystemSafetyNet.closeSafetyNetAndGuardedResourcesForThread();
+		}
+
+		// check that the safety net closed the stream

Review comment:
       I think this part is not needed since we already test that in other tests.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org