You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "huwh (via GitHub)" <gi...@apache.org> on 2023/09/19 13:37:20 UTC

[GitHub] [flink] huwh commented on a diff in pull request #23243: [FLINK-32846][runtime][JUnit5 Migration] The metrics package of flink-runtime module

huwh commented on code in PR #23243:
URL: https://github.com/apache/flink/pull/23243#discussion_r1330107838


##########
flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java:
##########
@@ -138,17 +136,17 @@ public void testHandleOversizedMetricMessage() throws Exception {
         MetricDumpSerialization.MetricSerializationResult dump =
                 queryService.queryMetrics(TIMEOUT).get();
 
-        assertTrue(dump.serializedCounters.length > 0);
-        assertEquals(1, dump.numCounters);
-        assertTrue(dump.serializedMeters.length > 0);
-        assertEquals(1, dump.numMeters);
+        assertThat(dump.serializedCounters).isNotEmpty();
+        assertThat(dump.numCounters).isOne();
+        assertThat(dump.serializedMeters).isNotEmpty();
+        assertThat(dump.numMeters).isOne();
 
         // gauges exceeded the size limit and will be excluded
-        assertEquals(0, dump.serializedGauges.length);
-        assertEquals(0, dump.numGauges);
+        assertThat(dump.serializedGauges.length).isZero();

Review Comment:
   ditto



##########
flink-runtime/src/test/java/org/apache/flink/runtime/metrics/util/MetricUtilsTest.java:
##########
@@ -73,7 +70,7 @@ public void cleanupReferencedObjects() {
      * RpcSystem)} respects the given {@link MetricOptions#QUERY_SERVICE_THREAD_PRIORITY}.

Review Comment:
   Would you mind fix this broken JavaDoc into a hotfix commit?



##########
flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java:
##########
@@ -106,14 +104,14 @@ public void testCreateDump() throws Exception {
         MetricDumpSerialization.MetricSerializationResult emptyDump =
                 queryService.queryMetrics(TIMEOUT).get();
 
-        assertEquals(0, emptyDump.serializedCounters.length);
-        assertEquals(0, emptyDump.serializedGauges.length);
-        assertEquals(0, emptyDump.serializedHistograms.length);
-        assertEquals(0, emptyDump.serializedMeters.length);
+        assertThat(emptyDump.serializedCounters.length).isZero();

Review Comment:
   can we use `assertThat(emptyDump.serializedCounters).isEmpty();` here? which is similar to line 94.



-- 
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: issues-unsubscribe@flink.apache.org

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