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

Colin Patrick McCabe commented on HDFS-5564:
--------------------------------------------

To be honest, I have never liked the style of test where a "Before" function 
sets up a {{MiniDFSCluster}}.  It doesn't allow you to set a different 
configuration, which a lot of these tests have to do.  It hides a potentially 
expensive operation in a function that people modifying the tests may or may 
not look at.  And if you want to add a test that doesn't use a 
{{MiniDFSCluster}], you can't (in other words, you have to ignore the cluster 
that gets started anyway).

I think it would be better to have a common startup function and/or object 
which the tests which want a standardized setup can use, and forget about the 
Before annotation.  Unless there is some way of the test passing information to 
the before function which I'm unaware of?

> Refactor tests in TestCacheDirectives
> -------------------------------------
>
>                 Key: HDFS-5564
>                 URL: https://issues.apache.org/jira/browse/HDFS-5564
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: datanode, namenode
>    Affects Versions: 3.0.0
>            Reporter: Andrew Wang
>            Assignee: Andrew Wang
>            Priority: Trivial
>
> Some of the tests in TestCacheDirectives start their own MiniDFSCluster to 
> get a new config, even though we already start a cluster in the @Before 
> function. This contributes to longer test runs and code duplication.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to