Kaiyao Ke created YARN-11694:
--------------------------------

             Summary: 2 tests are non-idempotent (passes in the first run but 
fails in repeated runs in the same JVM)
                 Key: YARN-11694
                 URL: https://issues.apache.org/jira/browse/YARN-11694
             Project: Hadoop YARN
          Issue Type: Bug
            Reporter: Kaiyao Ke


## 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!

 at 
org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.newSourceName(DefaultMetricsSystem.java:152)

 at 
org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.sourceName(DefaultMetricsSystem.java:125)

 at 
org.apache.hadoop.metrics2.impl.MetricsSystemImpl.register(MetricsSystemImpl.java:229)

 at 
org.apache.hadoop.yarn.server.timelineservice.metrics.TimelineReaderMetrics.getInstance(TimelineReaderMetrics.java:61)

 at 
org.apache.hadoop.yarn.server.timelineservice.reader.TestTimelineReaderMetrics.setup(TestTimelineReaderMetrics.java:52)

 at java.base/java.lang.reflect.Method.invoke(Method.java:568)

 at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

 at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

```

 

## 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.3333 
(mean of 100, 200 and 100)

 

Error message in the 2nd run:

```

java.lang.AssertionError: expected:<100.0> but was:<133.33333333333334>

 at org.junit.Assert.fail(Assert.java:89)

 at org.junit.Assert.failNotEquals(Assert.java:835)

 at org.junit.Assert.assertEquals(Assert.java:555)

 at org.junit.Assert.assertEquals(Assert.java:685)

 at 
org.apache.hadoop.yarn.server.federation.store.metrics.TestFederationStateStoreClientMetrics.testSuccessfulCalls(TestFederationStateStoreClientMetrics.java:63)

 at java.base/java.lang.reflect.Method.invoke(Method.java:568)

```



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

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-dev-h...@hadoop.apache.org

Reply via email to