Skip to content

Commit

Permalink
YARN-11121:When the request request is null, should not get the resul…
Browse files Browse the repository at this point in the history
…ts of the metrics, modify the Unit Test so that the test meets the expectations
  • Loading branch information
slfan1989 committed May 2, 2022
1 parent e22ee3f commit 31492ab
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,15 @@ public void testGetApplicationAttemptEmptyRequest()


@Test
public void testGetClusterMetricsRequest() throws YarnException, IOException {
public void testGetClusterMetricsRequest() throws Exception {
LOG.info("Test FederationClientInterceptor : Get Cluster Metrics request");
// null request
GetClusterMetricsResponse response = interceptor.getClusterMetrics(null);
Assert.assertEquals(subClusters.size(),
response.getClusterMetrics().getNumNodeManagers());
LambdaTestUtils.intercept(YarnException.class,
"Missing getClusterMetrics request." ,
() -> interceptor.getClusterMetrics(null));

// normal request.
response =
GetClusterMetricsResponse response =
interceptor.getClusterMetrics(GetClusterMetricsRequest.newInstance());
Assert.assertEquals(subClusters.size(),
response.getClusterMetrics().getNumNodeManagers());
Expand Down Expand Up @@ -642,6 +643,11 @@ public void testGetApplicationsApplicationStateNotExists() throws Exception{
Assert.assertTrue(responseGet.getApplicationList().isEmpty());
}

/**
*
* @throws YarnException
* @throws IOException
*/
@Test
public void testGetClusterMetricsRequestNull() throws YarnException, IOException {
LOG.info(
Expand Down

0 comments on commit 31492ab

Please sign in to comment.