-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14365 from jrafanie/dont_retry_failed_message
If we can't update_attributes on a queue row, set state to error (cherry picked from commit 90cd1b0) https://bugzilla.redhat.com/show_bug.cgi?id=1436854
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe MiqQueueWorkerBase::Runner do | ||
context "#get_message_via_drb" do | ||
let(:server) { EvmSpecHelper.local_miq_server } | ||
let(:worker) { FactoryGirl.create(:miq_generic_worker, :miq_server => server, :pid => 123) } | ||
let(:runner) do | ||
allow_any_instance_of(MiqQueueWorkerBase::Runner).to receive(:sync_active_roles) | ||
allow_any_instance_of(MiqQueueWorkerBase::Runner).to receive(:sync_config) | ||
allow_any_instance_of(MiqQueueWorkerBase::Runner).to receive(:set_connection_pool_size) | ||
described_class.new(:guid => worker.guid) | ||
end | ||
|
||
it "sets message to 'error' and raises for unhandled exceptions" do | ||
# simulate what may happen if invalid yaml is deserialized | ||
allow_any_instance_of(MiqQueue).to receive(:args).and_raise(ArgumentError) | ||
q1 = FactoryGirl.create(:miq_queue) | ||
allow(runner) | ||
.to receive(:worker_monitor_drb) | ||
.and_return(double(:get_queue_message => [q1.id, q1.lock_version])) | ||
|
||
expect { runner.get_message_via_drb }.to raise_error(StandardError) | ||
expect(q1.reload.state).to eql(MiqQueue::STATUS_ERROR) | ||
end | ||
end | ||
end |