argoyal2212 commented on code in PR #29157:
URL: https://github.com/apache/flink/pull/29157#discussion_r4471056590


##########
flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpointTest.java:
##########
@@ -75,4 +88,81 @@ void cleansUpExpiredExecutionGraphs() throws Exception {
             ExecutorUtils.gracefulShutdown(timeout, TimeUnit.MILLISECONDS, 
executor);
         }
     }
+
+    @Test
+    void usesGeneratedLogUrlHandlersByDefault() throws Exception {
+        final Tuple2<RestHandlerSpecification, ?> jobManagerLogUrlHandler =
+                findHandler(new Configuration(), 
JobManagerLogUrlHeaders.getInstance());
+        final Tuple2<RestHandlerSpecification, ?> taskManagerLogUrlHandler =
+                findHandler(new Configuration(), 
TaskManagerLogUrlHeaders.getInstance());
+
+        
assertThat(jobManagerLogUrlHandler.f1).isInstanceOf(GeneratedLogUrlHandler.class);
+        
assertThat(taskManagerLogUrlHandler.f1).isInstanceOf(GeneratedLogUrlHandler.class);
+    }
+
+    @Test
+    void usesGeneratedLogUrlHandlersWhenCustomHandlersAreExplicitlyDisabled() 
throws Exception {
+        final Configuration configuration = new Configuration();
+        configuration.set(
+                HistoryServerOptions
+                        
.HISTORY_SERVER_JOBMANAGER_TASKMANAGER_LOG_ENABLE_CUSTOM_HANDLERS,
+                false);
+
+        final Tuple2<RestHandlerSpecification, ?> jobManagerLogUrlHandler =
+                findHandler(configuration, 
JobManagerLogUrlHeaders.getInstance());
+        final Tuple2<RestHandlerSpecification, ?> taskManagerLogUrlHandler =
+                findHandler(configuration, 
TaskManagerLogUrlHeaders.getInstance());
+
+        
assertThat(jobManagerLogUrlHandler.f1).isInstanceOf(GeneratedLogUrlHandler.class);
+        
assertThat(taskManagerLogUrlHandler.f1).isInstanceOf(GeneratedLogUrlHandler.class);
+    }
+
+    @Test
+    void usesCustomLogUrlHandlersWhenEnabled() throws Exception {
+        final Configuration configuration = new Configuration();
+        configuration.set(
+                HistoryServerOptions
+                        
.HISTORY_SERVER_JOBMANAGER_TASKMANAGER_LOG_ENABLE_CUSTOM_HANDLERS,
+                true);
+
+        final Tuple2<RestHandlerSpecification, ?> jobManagerLogUrlHandler =
+                findHandler(configuration, 
JobManagerLogUrlHeaders.getInstance());
+        final Tuple2<RestHandlerSpecification, ?> taskManagerLogUrlHandler =
+                findHandler(configuration, 
TaskManagerLogUrlHeaders.getInstance());
+
+        
assertThat(jobManagerLogUrlHandler.f1).isInstanceOf(JobManagerLogUrlHandler.class);
+        
assertThat(taskManagerLogUrlHandler.f1).isInstanceOf(TaskManagerLogUrlHandler.class);
+    }
+
+    private static Tuple2<RestHandlerSpecification, ?> findHandler(

Review Comment:
   Overrides the env read so no more global state, switched to .equals, and 
added a missing-env fallback case.



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