Description
TestMRAppMetrics should invoke shutdown method in DefaultMetricsSystem after completion. Since it can lead to failing other tests. For example, TestRMContainerAllocator#testReportedAppProgress fails when run after TestMRAppMetrics#testNames with the following error:
org.apache.hadoop.metrics2.MetricsException: Metrics source MRAppMetrics already exists!
We do not catch this on the trunk since the test TestRMContainerAllocator#testUnsupportedMapContainerRequirement run first and "DefaultMetricsSystem.shutdown();" invokes after completion. But since JUnit does not guarantee the order of the tests we should fix it.
Also, this is affected by previous versions which run testReportedAppProgress first (I faced it on 2.7.0 version). And reproduced on the trunk.