[
https://issues.apache.org/jira/browse/HDFS-10599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15475238#comment-15475238
]
Manoj Govindassamy commented on HDFS-10599:
-------------------------------------------
Got it. I referred how other CLI/org.apache.hadoop.util.{{Tool}} implementers
(like DFSAdmin, DFSHAAdmin, DFSck, DistCp, etc.,) have their unit tests written
and it looks like almost all of these are directly invoking
{{ToolRunner.run()}} directly from the tests instead of using
{{ProcessBuilder}} or {{Runtime}} to launch the Tool application. The main
reason for running these Tools via ToolRunner directly is for submitting a
custom {{PrintStream}} object (when constructing the Tool) so that Tool outputs
can be verified by the test.
Many of {{TestDiskBalancerCommand}} unit tests also need DiskBalancer CLI
Tool's output for verifying messages and other expected patterns. So, looks
like we can also follow the same pattern and call {{ToolRunner.run()}} with
custom {{DiskBalancer}} object constructed with our own {{PrintStream}}. I
prototyped this and the test runs fine.
[~anu], your thoughts on the above model please ?
> DiskBalancer: Execute CLI via Shell
> ------------------------------------
>
> Key: HDFS-10599
> URL: https://issues.apache.org/jira/browse/HDFS-10599
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: balancer & mover
> Affects Versions: 3.0.0-alpha1
> Reporter: Anu Engineer
> Assignee: Manoj Govindassamy
>
> DiskBalancer CLI invokes CLI functions directly instead of shell. This is not
> representative of how end users use it. To provide good unit test coverage,
> we need to have tests where DiskBalancer CLI is invoked via shell.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]