Author: daijy
Date: Thu Jan 16 05:58:23 2014
New Revision: 1558700

URL: http://svn.apache.org/r1558700
Log:
HIVE-6211: WebHCat job status E2E tests fail in presence of other jobs

Modified:
    hive/trunk/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm
    hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf

Modified: hive/trunk/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm
URL: 
http://svn.apache.org/viewvc/hive/trunk/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm?rev=1558700&r1=1558699&r2=1558700&view=diff
==============================================================================
--- hive/trunk/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm 
(original)
+++ hive/trunk/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm Thu 
Jan 16 05:58:23 2014
@@ -650,13 +650,22 @@ sub compare
 
         # decode $testResult->{'body'} to an array of hash
         my $body = decode_json $testResult->{'body'};
-        my @sorted_body;
+        my @filtered_body;
+        if (defined $testCmd->{'filter_job_names'}) {
+          foreach my $filter (@{$testCmd->{'filter_job_names'}}) {
+            my @filtered_body_tmp = grep { $_->{detail}{profile}{jobName} eq 
$filter } @$body;
+            @filtered_body = (@filtered_body, @filtered_body_tmp);
+          }
+        } else {
+          @filtered_body = @$body;
+        }
+        my @sorted_filtered_body;
         if (ref @$body[0] eq 'HASH') {
-          @sorted_body = sort { $a->{id} cmp $b->{id} } @$body;
+          @sorted_filtered_body = sort { $a->{id} cmp $b->{id} } 
@filtered_body;
         } else {
-          @sorted_body = sort { $a cmp $b } @$body;
+          @sorted_filtered_body = sort { $a cmp $b } @filtered_body;
         }
-        my $value = $path->value(\@sorted_body);
+        my $value = $path->value(\@sorted_filtered_body);
         
         if ($value !~ /$regex_expected_value/s) {
           print $log "$0::$subName INFO check failed:"

Modified: hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf
URL: 
http://svn.apache.org/viewvc/hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf?rev=1558700&r1=1558699&r2=1558700&view=diff
==============================================================================
--- hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf (original)
+++ hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf Thu Jan 16 
05:58:23 2014
@@ -86,6 +86,7 @@ $cfg = 
      'method' => 'GET',
      'url' => 
':TEMPLETON_URL:/templeton/v1/jobs?user.name=:UNAME_OTHER:&showall=true&fields=*',
      'format_header' => 'Content-Type: application/json',
+     'filter_job_names' => ['TempletonControllerJob', 
'PigLatin:loadstore.pig'],
      'json_path' => {'$[-1:].detail.status.username' => ':UNAME_OTHER:', 
'$[-2:].detail.status.username' => ':UNAME_OTHER:', 
'$[-3:].detail.status.username' => ':UNAME:',
                      '$[-4:].detail.status.username' => ':UNAME:', 
'$[-5:].detail.status.username' => ':UNAME_OTHER:', 
'$[-6:].detail.status.username' => ':UNAME_OTHER:'},
      'status_code' => 200,
@@ -97,6 +98,7 @@ $cfg = 
      'method' => 'GET',
      'url' => 
':TEMPLETON_URL:/templeton/v1/jobs?user.name=:UNAME_OTHER:&fields=*',
      'format_header' => 'Content-Type: application/json',
+     'filter_job_names' => ['TempletonControllerJob', 
'PigLatin:loadstore.pig'],
      'json_path' => {'$[-1:].detail.status.username' => ':UNAME_OTHER:', 
'$[-2:].detail.status.username' => ':UNAME_OTHER:', 
'$[-3:].detail.status.username' => ':UNAME_OTHER:',
                      '$[-4:].detail.status.username' => ':UNAME_OTHER:'},
      'status_code' => 200,
@@ -118,6 +120,7 @@ $cfg = 
      'method' => 'GET',
      'url' => 
':TEMPLETON_URL:/templeton/v1/jobs?user.name=:UNAME_OTHER:&fields=*',
      'format_header' => 'Content-Type: application/json',
+     'filter_job_names' => ['PigLatin:loadstore.pig'],
      'json_path' => {'$[-1:].id' => 'job_.*', 
                      '$[-1:].detail.status.jobId' => 'job_.*',
                      '$[-1:].detail.status.runState' => '\\d+',


Reply via email to