[
https://issues.apache.org/jira/browse/YARN-11899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047080#comment-18047080
]
ASF GitHub Bot commented on YARN-11899:
---------------------------------------
ayushtkn commented on code in PR #8133:
URL: https://github.com/apache/hadoop/pull/8133#discussion_r2640470416
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/TestRouterMetrics.java:
##########
@@ -62,6 +64,19 @@ public static void init() {
LOG.info("Test: aggregate metrics are updated correctly");
}
+ @BeforeEach
+ public void setup() {
+ //reset metrics before each test
+ RouterMetrics.destroy();
+ metrics = RouterMetrics.getMetrics();
+ }
+
+ @AfterEach
+ public void tearDown() {
+ RouterMetrics.destroy();
+ metrics = RouterMetrics.getMetrics();
+ }
+
/**
Review Comment:
isn't just doing in BeforeEach enough?
> TestRouterMetrics is order dependent
> ------------------------------------
>
> Key: YARN-11899
> URL: https://issues.apache.org/jira/browse/YARN-11899
> Project: Hadoop YARN
> Issue Type: Test
> Reporter: Paco Chan
> Priority: Trivial
> Labels: pull-request-available
>
> The following tests are order-dependent if interleaved with other tests:
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testAppsFailedCreated|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testAppsFailedKilled|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testAppsFailedSubmitted|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testAppsReportFailed|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testMulipleAppsReportFailed|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testSucceededAppsCreated|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testSucceededAppsKilled|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testSucceededAppsReport|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testSucceededAppsSubmitted|
> |org.apache.hadoop.yarn.server.router.TestRouterMetrics.testSucceededMultipleAppsReport|
>
> This is because there is some state in the metrics that is not cleaned after
> the test is run. Some other tests can mutate the router metrics between tests.
>
> To solve this problem, the metrics were reset after every test.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]