adoroszlai commented on code in PR #8021:
URL: https://github.com/apache/ozone/pull/8021#discussion_r1985933871


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/container/metrics/TestSCMContainerManagerMetrics.java:
##########
@@ -134,37 +129,18 @@ public void testContainerOpsMetrics() throws Exception {
 
   @Test
   public void testReportProcessingMetrics() throws Exception {
-    String volumeName = "vol-" + UUID.randomUUID();
-    String bucketName = "bucket1";
-    String key = "key1";
-
     MetricsRecordBuilder metrics =
         getMetrics(SCMContainerManagerMetrics.class.getSimpleName());
     assertThat(getLongCounter("NumContainerReportsProcessedSuccessful", 
metrics))
         .isPositive();
 
-    final long previous = getLongCounter("NumICRReportsProcessedSuccessful", 
metrics);
-
     // Create key should create container on DN.
-    client.getObjectStore().getClientProxy()
-        .createVolume(volumeName);
-    client.getObjectStore().getClientProxy()
-        .createBucket(volumeName, bucketName);
-    OzoneOutputStream ozoneOutputStream = client
-        .getObjectStore().getClientProxy().createKey(volumeName, bucketName,
-            key, 0, ReplicationType.RATIS, ReplicationFactor.ONE,
-            new HashMap<>());
-
-    String data = "file data";
-    ozoneOutputStream.write(data.getBytes(UTF_8), 0, data.length());
-    ozoneOutputStream.close();
-
+    TestDataUtil.createKeys(cluster(), 1);
 
     GenericTestUtils.waitFor(() -> {
       final MetricsRecordBuilder scmMetrics =
           getMetrics(SCMContainerManagerMetrics.class.getSimpleName());
-      return getLongCounter("NumICRReportsProcessedSuccessful",
-          scmMetrics) >= previous + 1;
+      return getLongCounter("NumICRReportsProcessedSuccessful", scmMetrics) > 
0;

Review Comment:
   IMO only slightly less meaningful.
   
   Checking `NumICRReportsProcessedSuccessful > 0` verifies whether the metric 
is updated at all.  If datanodes do not these send reports, or the report 
handler does not increment the metric, the test would still fail.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to