[ 
https://issues.apache.org/jira/browse/HDDS-10311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825744#comment-17825744
 ] 

Attila Doroszlai commented on HDDS-10311:
-----------------------------------------

bq. assertions about metrics should be merged into functional tests

There are separate tests for creating volumes, buckets, etc.  These tests 
usually check the contents or other properties of the volume, bucket, etc.  The 
same tests could also check metrics.  Running tests for functionality and 
metrics separately is a waste of execution time and also duplicates code.

Example:

{code}
diff --git 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequest.java
 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequest.java
index 201c2a759f..579af43d18 100644
--- 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequest.java
+++ 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequest.java
@@ -337,6 +337,7 @@ protected void doValidateAndUpdateCache(String volumeName, 
String bucketName,
     OMBucketCreateRequest omBucketCreateRequest =
         new OMBucketCreateRequest(modifiedRequest);
 
+    final long initialCount = omMetrics.getNumBucketCreates();
 
     OMClientResponse omClientResponse =
         omBucketCreateRequest.validateAndUpdateCache(ozoneManager, 1);
@@ -369,6 +370,7 @@ protected void doValidateAndUpdateCache(String volumeName, 
String bucketName,
     // verify OMResponse.
     verifySuccessCreateBucketResponse(omClientResponse.getOMResponse());
 
+    assertEquals(initialCount + 1, omMetrics.getNumBucketCreates());
   }
 
   protected void verifyRequest(OMRequest modifiedOmRequest,
{code}

> Speed up TestOmMetrics
> ----------------------
>
>                 Key: HDDS-10311
>                 URL: https://issues.apache.org/jira/browse/HDDS-10311
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: test
>            Reporter: Attila Doroszlai
>            Assignee: Will Xiao
>            Priority: Major
>
> {code}
> Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 115.365 s - 
> in org.apache.hadoop.ozone.om.TestOmMetrics
> {code}
> # assertions about metrics should be merged into functional tests (no need to 
> test e.g. {{listKeys}} and metrics for {{listKeys}} separately
> # no need to start new cluster for each test case



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to