kaiyaok2 opened a new pull request, #6793: URL: https://github.com/apache/hadoop/pull/6793
## Description of PR SImilar as #6785 #6790 , this PR fixes 2 non-idempotent unit tests detected. These tests pass in the first run but fails in the second run in the same JVM. ### `TestTimelineReaderMetrics#testTimelineReaderMetrics` `org.apache.hadoop.yarn.server.timelineservice.reader.TestTimelineReaderMetrics#testTimelineReaderMetrics` does not perform a source unregistration after test execution, so the `TimelineReaderMetrics.getInstance()` call in repeated runs will throw an error since the metrics source `TimelineReaderMetrics` already exists. Error message in the 2nd run: ``` org.apache.hadoop.metrics2.MetricsException: Metrics source TimelineReaderMetrics already exists! ``` Fix: Unregister `"TimelineReaderMetrics"` before the test. ### TestFederationStateStoreClientMetrics#testSuccessfulCalls `org.apache.hadoop.yarn.server.federation.store.metrics.TestFederationStateStoreClientMetrics#testSuccessfulCalls` retrieves the historical number of successful calls, but does not retrieve the historical average latency of those calls. For example, it assertsĀ `FederationStateStoreClientMetrics.getLatencySucceededCalls()` is 100 after the `goodStateStore.registerSubCluster(100);` call. However, in the second execution of the test, 2 historical calls from the first execution (with latency 100 and 200 respectively) has already been recorded, so `FederationStateStoreClientMetrics.getLatencySucceededCalls()` will be 133.33... (mean of 100, 200 and 100) Error message in the 2nd run: ``` java.lang.AssertionError: expected:<100.0> but was:<133.33333333333334> ``` Fix: Retrieve existing latency data and use them for calculation. ### How was this patch tested? After the patch, rerunning the tests in the same JVM does not produce any exceptions. -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org