Izeren commented on code in PR #27617:
URL: https://github.com/apache/flink/pull/27617#discussion_r2814097644


##########
flink-core/src/test/java/org/apache/flink/core/fs/FileSystemTest.java:
##########
@@ -115,6 +124,67 @@ void testKnownFSWithoutPluginsAndException() {
         }
     }
 
+    private static final String PRIORITY_TEST_SCHEME = "priority-test";
+
+    static Stream<Arguments> prioritySelectionCases() {

Review Comment:
   Fair, can add



##########
flink-core/src/test/java/org/apache/flink/core/fs/FileSystemTest.java:
##########
@@ -115,6 +124,67 @@ void testKnownFSWithoutPluginsAndException() {
         }
     }
 
+    private static final String PRIORITY_TEST_SCHEME = "priority-test";
+
+    static Stream<Arguments> prioritySelectionCases() {
+        return Stream.of(
+                Arguments.of(0, 0, DummyFsB.class),
+                Arguments.of(0, 100, DummyFsB.class),
+                Arguments.of(100, 0, DummyFsA.class),
+                Arguments.of(-10, 0, DummyFsB.class),
+                Arguments.of(50, 50, DummyFsB.class));
+    }
+
+    @ParameterizedTest
+    @MethodSource("prioritySelectionCases")
+    void shouldSelectFactoryByPriority(
+            final int firstPriority,
+            final int secondPriority,
+            final Class<? extends FileSystem> expectedFsClass)
+            throws Exception {
+        final Configuration config = new Configuration();
+        config.set(
+                CoreOptions.fileSystemFactoryPriority(
+                        PRIORITY_TEST_SCHEME, FactoryA.class.getName()),
+                firstPriority);
+        config.set(
+                CoreOptions.fileSystemFactoryPriority(
+                        PRIORITY_TEST_SCHEME, FactoryB.class.getName()),
+                secondPriority);
+
+        try {
+            FileSystem.initialize(config, pluginManager(new FactoryA(), new 
FactoryB()));
+
+            
assertThat(createAndUnwrap(PRIORITY_TEST_SCHEME)).isInstanceOf(expectedFsClass);
+        } finally {
+            FileSystem.initialize(new Configuration(), null);
+        }
+    }
+
+    @Test
+    void shouldRegisterSingleFactory() throws Exception {
+        try {
+            FileSystem.initialize(new Configuration(), pluginManager(new 
FactoryA()));
+
+            
assertThat(createAndUnwrap(PRIORITY_TEST_SCHEME)).isInstanceOf(DummyFsA.class);
+        } finally {
+            FileSystem.initialize(new Configuration(), null);
+        }
+    }
+
+    @Test
+    void shouldUseFactoryDeclaredPriorityWhenNoConfigSet() throws Exception {

Review Comment:
   Fair, can add



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

Reply via email to