Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions t/api/14-plugin_obs_rsync.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use FindBin;
use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../external/os-autoinst-common/lib";
use OpenQA::Test::TimeLimit '50';
use Mojo::IOLoop;
use Test::MockObject;

use OpenQA::Test::Utils 'perform_minion_jobs';
use OpenQA::Test::ObsRsync 'setup_obs_rsync_test';

Expand Down Expand Up @@ -124,4 +126,14 @@ subtest 'test lock after failure' => sub {
lock_test();
};

subtest 'Finish job when retry count exceeded' => sub {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry
if you check the other descriptions, all start with low case. Could you adjust this as well?

use_ok('OpenQA::WebAPI::Plugin::ObsRsync::Task');
my $finish_return;
my $job = Test::MockObject->new->mock('retries', sub { 42 })->set_true('retry')->set_true('finish')
->mock('finish', sub { shift; $finish_return = [@_]; return 1 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesnt make sense. Because you set finish to true and right after you mock it again.
In additional I do not think you need the set_true('retry'). AFAIU $job->retry it wont run based on the arguments ($job, undef, undef, 1, 1). $retry_max_count is true (aka false due to negation) and I think $job->retries < $retry_max_count is also false with those values.

OpenQA::WebAPI::Plugin::ObsRsync::Task::_retry_or_finish($job, undef, undef, 1, 1);

like $finish_return->[0]{message}, qr/Exceeded retry count \d+\. Consider job will be re-triggered later/;
};

done_testing();
Loading