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

Will Xiao commented on HDDS-10311:
----------------------------------

I can confirm only the OzoneManager.restart() is the cause of OMMetrics's NPE. 
And the inject exception part isn't the cause for NPE.

I comment out both OzoneManager.restart() and keep the inject exception part.

Then I have to alter many numbers in assertCounter such as below. In the end, 
the mvn test is successful now.
{code:java}
@@ -149,13 +120,13 @@ public void testVolumeOps() throws Exception {
-    assertCounter(“NumVolumeOps”, 5L, omMetrics);
-    assertCounter(“NumVolumeCreates”, 1L, omMetrics);
+    assertCounter(“NumVolumeOps”, 11L, omMetrics);
+    assertCounter(“NumVolumeCreates”, 7L, omMetrics);
-    assertCounter(“NumVolumes”, 1L, omMetrics);
+    assertCounter(“NumVolumes”, 7L, omMetrics); {code}
I think this is what you mean the expected metrics values are "magic" if both 
test class want to modify the same resources.

Is there a way we can "reset" the OMMetrics in @BeforeEach or in each test 
classes to simulate OzoneManager.restart() but don't actually restart the OM?

> 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