Benjamin Teke created YARN-10994:
------------------------------------

             Summary: Remove the clusterResource param from 
RMNodeLabelsManager.getResourceByLabel
                 Key: YARN-10994
                 URL: https://issues.apache.org/jira/browse/YARN-10994
             Project: Hadoop YARN
          Issue Type: Sub-task
            Reporter: Benjamin Teke


RMNodeLabelsManager.getResourceByLabel has currently two parameters: String 
label and Resource clusterResource. The latter however is only used by tests 
during mocking: the parameter supplied in the production code by the callers 
are returned in tests. See ReservationSystemTestUtil.createRMContext:

{code:java}
...
 when(nlm.getResourceByLabel(any(), any(Resource.class)))
        .thenAnswer(new Answer<Resource>() {
          @Override
          public Resource answer(InvocationOnMock invocation) throws Throwable {
            Object[] args = invocation.getArguments();
            return (Resource) args[1];
          }
        });
...
{code}

This is misleading and hard to understand (no way of knowing with what values 
are the clusterResources mocked by looking at the tests) and generates 
unnecessary production code so it should be removed and the tests should be 
properly mocked.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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