Issue Details (XML | Word | Printable)

Key: HADOOP-4708
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Boris Shkolnik
Reporter: Boris Shkolnik
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Add support for dfsadmin commands for test TestCLI unit test

Created: 21/Nov/08 10:01 PM   Updated: 23/Apr/09 07:17 PM
Return to search
Component/s: test
Affects Version/s: 0.20.0
Fix Version/s: 0.20.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works HADOOP-4708.patch 2008-11-25 07:09 PM Boris Shkolnik 9 kB
Text File Licensed for inclusion in ASF works HADOOP-4708-1.patch 2008-12-01 10:44 PM Boris Shkolnik 10 kB
Issue Links:
Dependants
 

Hadoop Flags: Reviewed
Resolution Date: 02/Dec/08 07:28 PM


 Description  « Hide
Curretly TestCLI assumes dfs command when describing tests in testConf.xml
we need to add ability to run dfsadmin commands too.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Boris Shkolnik added a comment - 21/Nov/08 10:24 PM
I suggest we add <admin-command> to testConf.xml to describe a dfsadmin command to be run by the framework.

implementation wise we should change a command from being a String to be a class that knows what type of command it is and use DFSShell for dfsadmin commands.


Boris Shkolnik added a comment - 25/Nov/08 07:09 PM
patch

Chris Douglas added a comment - 26/Nov/08 10:06 PM
It would be nice if more of the CommandExecutor logic were part of the enumerated type, but it's not necessary for this patch.
  • For enums:
    +    	  if(cmd.getType()==CommandType.ADMIN) {
    +    		  CommandExecutor.executeDFSAdminCommand(cmd.getCmd(), namenode);
    +    	  } else {
    +    		  CommandExecutor.executeFSCommand(cmd.getCmd(), namenode);
    +    	  }
    

    This should probably be a switch stmt.

  • This change is unnecessary:
    @@ -107,8 +109,7 @@
         conf = new Configuration();
         cluster = new MiniDFSCluster(conf, 1, true, null);
         namenode = conf.get("fs.default.name", "file:///");
    -    clitestDataDir = new File(TEST_CACHE_DATA_DIR).
    -      toURI().toString().replace(' ', '+');
    +    clitestDataDir = new File(TEST_CACHE_DATA_DIR).toURI().toString().replace(' ', '+');
         username = System.getProperty("user.name");
    
  • TestCmd.type and TestCmd.cmd can be final
  • Why getCmd instead of just toString()?
  • The cast to String is (still) unnecessary:
    -              expandCommand((String) testCommands.get(j)) + "]");
    +              expandCommand((String) testCommands.get(j).getCmd()) + "]");
    

Hadoop QA added a comment - 26/Nov/08 10:53 PM
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12394680/+HADOOP-4708.patch
against trunk revision 720930.

+1 @author. The patch does not contain any @author tags.

+1 tests included. The patch appears to include 9 new or modified tests.

+1 javadoc. The javadoc tool did not generate any warning messages.

+1 javac. The applied patch does not increase the total number of javac compiler warnings.

+1 findbugs. The patch does not introduce any new Findbugs warnings.

+1 Eclipse classpath. The patch retains Eclipse classpath integrity.

+1 core tests. The patch passed core unit tests.

+1 contrib tests. The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3655/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3655/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3655/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3655/console

This message is automatically generated.


Boris Shkolnik added a comment - 01/Dec/08 07:55 PM
recommended fixes to the patch:
1. moving logic of selecting correct function for a type of command to CommandExecutor (I think it makes sense to do it now, cause it is more clean)
2. making get methods final
3. removing unnecessary formating and casting.
4. changed to switch from if-else with a default throw.

I left getCmd and not toString() - it makes more sense.


Chris Douglas added a comment - 02/Dec/08 07:28 PM
+1

I just committed this. Thanks, Boris


Hudson added a comment - 03/Dec/08 02:32 PM
Integrated in Hadoop-trunk #677 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/677/)
. Add support for dfsadmin commands in TestCLI. Contributed by Boris Shkolnik.

Hudson added a comment - 10/Dec/08 04:48 PM
Integrated in Hadoop-trunk #684 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/684/)
. Add binaries missed in the initial checkin for Chukwa. Contributed by Eric Yang.