App-Prove-Plugin-Elasticsearch
view release on metacpan or search on metacpan
lib/App/Prove/Elasticsearch/Indexer.pm view on Meta::CPAN
doc => {
defect => \@df_merged,
},
}
);
$update{body}{doc}{status} = $opts{status} if $opts{status};
my $res = $e->update(%update);
print "Associated cases to document $hit->{_id}\n"
if $res->{result} eq 'updated';
if (!grep { $res->{result} eq $_ } qw{updated noop}) {
print
"Something went wrong associating cases to document $hit->{_id}!\n$res->{result}\n";
$failures++;
}
}
print "No cases matching your query could be found. No action was taken.\n"
unless $attempts;
return $failures;
lib/App/Prove/Elasticsearch/Planner/Default.pm view on Meta::CPAN
index => $index,
id => $plan->{id},
type => 'testplan',
body => {
doc => {
tests => \@tests_merged,
},
}
);
print "Updated tests in plan #$plan->{id}\n" if $res->{result} eq 'updated';
if (!grep { $res->{result} eq $_ } qw{updated noop}) {
print
"Something went wrong associating cases to document $plan->{id}!\n$res->{result}\n";
return 1;
}
print "Successfully Updated plan #$plan->{id}\n";
return 0;
}
sub make_plan {
my (%options) = @_;
lib/App/Prove/Elasticsearch/Planner/Default.pm view on Meta::CPAN
=back
=head2 get_plan_status(plan)
Gets the status of the tests to be run in the provided plan, regardless of if the plan even exists.
=head2 add_plan_to_index($plan)
Add or update a test plan.
Dies if the plan cannot be added/updated.
Returns 1 in the event of failure.
=head2 make_plan(%plan)
Build a test plan ready to be indexed, and return it.
Takes a hash describing the plan to be created and then mangles it to fit in openstack.
=head2 make_plan_update($existing_plan,%plan)
lib/App/ape/update.pm view on Meta::CPAN
=item B<-v [VERSION]> : filter cases to associate by the provided version(s).
=item B<-c [CONFIGURATION]> : override configuration value, e.g. server.host=some.es.host. Can be passed multiple times.
=item B<-s [STATUS]> : override the current status of the relevant test results.
=back
After applying the options, the defect will be applied to all the tests you have provided as arguments.
If a result is updated or fails to update, you will be notified the IDs of the documents which failed/succeeded to update, and a reason.
=head1 CONSTRUCTOR
=head2 new(@ARGV)
Process arguments and require the relevant plugins required to update a result in elasticsearch.
=head1 METHODS
=head2 run()
t/App-Prove-Elasticsearch-Indexer.t view on Meta::CPAN
platform => ['clownOS','clownBrowser'],
}
}
]
}
};
$App::Prove::Elasticsearch::Indexer::e = bless({},'BogusSearch');
no warnings qw{redefine once};
local *BogusSearch::search = sub { shift; %searchargs = @_; return $searchreturn };
local *BogusSearch::update = sub { shift; %arg2check = @_; return { result => 'updated' } };
use warnings;
my $expected_search = {
index => 'testsuite',
from => 0,
size => $App::Prove::Elasticsearch::Indexer::max_query_size,
body => {
query => {
bool => {
must => [
t/App-Prove-Elasticsearch-Indexer.t view on Meta::CPAN
#Check the case where we get a failure
no warnings qw{redefine once};
local *BogusSearch::update = sub { shift; %arg2check = @_; return { result => 'error' } };
use warnings;
is(App::Prove::Elasticsearch::Indexer::associate_case_with_result(%args),1,"Number of errors encountered reported");
#Check the case where we have bad version/platform/name returned
{
local $args{platforms} = ['zipadoodah'];
like(capture_merged {App::Prove::Elasticsearch::Indexer::associate_case_with_result(%args)},qr/No cases matching your query/i,"No cases updated if we don't find correct platform");
}
{
local $args{versions} = ['zipadoodah'];
like(capture_merged {App::Prove::Elasticsearch::Indexer::associate_case_with_result(%args)},qr/No cases matching your query/i,"No cases updated if we don't find correct versions");
}
{
local $args{case} = 'zipadoodah';
like(capture_merged {App::Prove::Elasticsearch::Indexer::associate_case_with_result(%args)},qr/No cases matching your query/i,"No cases updated if we don't find correct case");
}
}
( run in 0.805 second using v1.01-cache-2.11-cpan-05444aca049 )