diff --git a/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm b/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm index 0951eb8..477cded 100644 --- a/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm +++ b/hcatalog/src/test/e2e/templeton/drivers/TestDriverCurl.pm @@ -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:" diff --git a/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf b/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf index 4fa4e83..b8c6307 100644 --- a/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf +++ b/hcatalog/src/test/e2e/templeton/tests/jobstatus.conf @@ -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+',