You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2022/04/05 08:07:01 UTC

[flink] branch master updated: [FLINK-27042][metrics] Fix instability of StreamTaskTest#testMailboxMetricsScheduling

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 450a142a58d [FLINK-27042][metrics] Fix instability of StreamTaskTest#testMailboxMetricsScheduling
450a142a58d is described below

commit 450a142a58d48c92a9c2c4c82c317cfdb9548a5f
Author: Sebastian Mattheis <se...@ververica.com>
AuthorDate: Tue Apr 5 10:06:47 2022 +0200

    [FLINK-27042][metrics] Fix instability of StreamTaskTest#testMailboxMetricsScheduling
    
    Remove assertion for latency measurement from StreamTaskTest#testMailboxMetricsScheduling as it
    causes instability and is already covered in StreamTaskTest#testMailboxMetricsMeasurement.
---
 .../apache/flink/streaming/runtime/tasks/StreamTaskTest.java  | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
index fb9921dde28..f2bac03e2e3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
@@ -1769,9 +1769,8 @@ public class StreamTaskTest extends TestLogger {
 
     /**
      * Tests mailbox metrics latency and queue size and verifies that (1) latency measurement is
-     * executed initially once and at least once triggered by timer, (2) latency max value is
-     * greater than zero and (3) mailbox size is greater than zero for some time and eventually
-     * equals to zero.
+     * executed once initially and at least once triggered by timer and (2) mailbox size is greater
+     * than zero for some time and eventually equals to zero.
      *
      * @throws Exception on {@link MockEnvironmentBuilder#build()} failure.
      */
@@ -1800,10 +1799,7 @@ public class StreamTaskTest extends TestLogger {
                                         mailboxProcessor
                                                 .getMainMailboxExecutor()
                                                 .execute(() -> {}, "mail");
-                                        // The actual delay here is irrelevant for the test but
-                                        // delay should be at least once 10 ms to reach a measurable
-                                        // delay >~ 8 ms.
-                                        Thread.sleep(mailboxLatencyMetric.getCount() == 0 ? 10 : 1);
+                                        Thread.sleep(1);
                                     } else {
                                         controller.suspendDefaultAction();
                                         mailboxProcessor.suspend();
@@ -1820,7 +1816,6 @@ public class StreamTaskTest extends TestLogger {
             assertThat(
                     mailboxLatencyMetric.getCount(),
                     greaterThanOrEqualTo(new Long(minMeasurements)));
-            assertThat(mailboxLatencyMetric.getStatistics().getMax(), greaterThan(0L));
             assertThat(maxMailboxSize.get(), greaterThan(0));
             assertThat(mailboxSizeMetric.getValue(), equalTo(0));
         }