[ 
https://issues.apache.org/jira/browse/YARN-9995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17060040#comment-17060040
 ] 

Szilard Nemeth commented on YARN-9995:
--------------------------------------

Hi [~BilwaST],
Yes, you are right. Rephrased the description message.
Feel free to come up with any way that improves the code quality regarding 
SchedConfUpdateInfo.

For example, I don't like that we have pieces of code like this: 

{code:java}
    schedUpdateInfo = new SchedConfUpdateInfo();
    cli.addQueues("root.b:b1=bVal1;root.c:c1=cVal1", schedUpdateInfo);
    assertEquals(2, schedUpdateInfo.getAddQueueInfo().size());
    QueueConfigInfo bAddInfo = schedUpdateInfo.getAddQueueInfo().get(0);
    assertEquals("root.b", bAddInfo.getQueue());
    Map<String, String> bParams = bAddInfo.getParams();
    assertEquals(1, bParams.size());
    assertEquals("bVal1", bParams.get("b1"));
    QueueConfigInfo cAddInfo = schedUpdateInfo.getAddQueueInfo().get(1);
    assertEquals("root.c", cAddInfo.getQueue());
    Map<String, String> cParams = cAddInfo.getParams();
    assertEquals(1, cParams.size());
    assertEquals("cVal1", cParams.get("c1"));
{code}
There are many occurrences of schedUpdateInfo.getAddQueueInfo, for example. 
My intention was: It's better to hide these calls behind helper methods so when 
something changes with SchedConfUpdateInfo, tests should not be rewritten 
completely. 
Moreover, you can also hide these calls + do an assertion in one helper method.

Does this make sense?


> Code cleanup in TestSchedConfCLI
> --------------------------------
>
>                 Key: YARN-9995
>                 URL: https://issues.apache.org/jira/browse/YARN-9995
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Szilard Nemeth
>            Assignee: Bilwa S T
>            Priority: Minor
>
> Some tests are too verbose: 
> - add / delete / remove queues testcases: Creating SchedConfUpdateInfo 
> instances could be simplified with a helper method or something like that.
> - Some fields can be converted to local variables: sysOutStream, sysOut, 
> sysErr, csConf
> - Any additional cleanup



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

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

Reply via email to