zentol commented on a change in pull request #7459:  [FLINK-10822] Make 
MetricFetcher update interval configurable
URL: https://github.com/apache/flink/pull/7459#discussion_r248240593
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
 ##########
 @@ -184,4 +179,52 @@ public String getValue() {
 
                return dump;
        }
+
+       @Test
+       public void testLongUpdateInterval() {
+               final long updateInterval = 1000L;
+               final AtomicInteger requestMetricQueryServicePathsCounter = new 
AtomicInteger(0);
+               final RestfulGateway restfulGateway = 
createRestfulGateway(requestMetricQueryServicePathsCounter);
+
+               final MetricFetcher fetcher = 
createMetricFetcher(updateInterval, restfulGateway);
+
+               fetcher.update();
+               fetcher.update();
+
+               assertThat(requestMetricQueryServicePathsCounter.get(), is(1));
+       }
+
+       @Test
+       public void testShortUpdateInterval() throws InterruptedException {
 
 Review comment:
   I have doubts regarding the stability of this test since the MetricFetcher 
internally relies on `System.currentTimeMillis`, which isn't necessarily as 
granular as this test requires. I would increase the sleep to 50.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to