[ 
https://issues.apache.org/jira/browse/MAPREDUCE-1741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880068#action_12880068
 ] 

Vinay Kumar Thota commented on MAPREDUCE-1741:
----------------------------------------------

{noformat} 
+      int fileCount = 0;
+      jobFileFound = false;
+      for (FileStatus jobHistoryDoneFileStatus : jobHistoryDoneFileStatuses) {
+        LOG.info("jobHistoryDoneFileStatus path is :" + 
+            jobHistoryDoneFileStatus.getPath().toString());
+        LOG.info("jobIDString path is :" + jobIDString);
+        StringBuffer jobHistoryDoneFileBuffer = new 
+            StringBuffer(jobHistoryDoneFileStatus.getPath().toString());
+
+        if ( jobHistoryDoneFileBuffer.indexOf(jobIDString) != -1 ) {
+          jobFileFound = true;
+          fileCount++;
+          //Both the conf file and the job file has to be present
+          if (fileCount == 2) {
+            break;
+          }
+        }
{noformat} 

{noformat}
+      //Wait for the job to start running.
+      int count = 0;
+      while (jInfo != null && jInfo.getStatus().getRunState() 
+          != JobStatus.RUNNING) {
+        UtilsForTests.waitFor(10000);
+        count++;
+        jInfo = remoteJTClient.getJobInfo(jobID);
+        //If the count goes beyond 100 seconds, then break; This is to avoid
+        //infinite loop.
+        if (count > 10) {
+          Assert.fail("job has not reached running state for more than" +
+              "100 seconds. Failing at this point");
+        }
+      }
{noformat}
The above code blocks are repeating couple of times in the test. please make it 
common functions and utilize it.


> Automate the test scenario of  job related files are moved from history 
> directory to done directory
> ---------------------------------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-1741
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-1741
>             Project: Hadoop Map/Reduce
>          Issue Type: Test
>          Components: test
>    Affects Versions: 0.22.0
>            Reporter: Iyappan Srinivasan
>             Fix For: 0.22.0
>
>         Attachments: TestJobHistoryLocation-ydist-security-patch.txt, 
> TestJobHistoryLocation.patch, TestJobHistoryLocation.patch, 
> TestJobHistoryLocation.patch
>
>
> Job related files are moved from history directory to done directory, when
> 1) Job succeeds
> 2) Job is killed
> 3) When 100 files are put in the done directory
> 4) When multiple jobs are completed at the same time, some successful, some 
> failed.
> Also, two files, conf.xml and job files should be present in the done 
> directory.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to