forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 0
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 ManageIQ#13805 from jrafanie/stopping_worker
Kill workers that don't stop after a configurable time
- Loading branch information
Showing
7 changed files
with
74 additions
and
3 deletions.
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
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,34 @@ | ||
describe MiqServer::WorkerManagement::Monitor do | ||
context "#check_not_responding" do | ||
let(:server) { EvmSpecHelper.local_miq_server } | ||
let(:worker) do | ||
FactoryGirl.create(:miq_worker, | ||
:type => "MiqGenericWorker", | ||
:miq_server => server, | ||
:pid => 12345, | ||
:last_heartbeat => 5.minutes.ago) | ||
end | ||
|
||
before do | ||
server.setup_drb_variables | ||
server.worker_add(worker.pid) | ||
end | ||
|
||
it "destroys an unresponsive 'stopping' worker" do | ||
worker.update(:last_heartbeat => 20.minutes.ago) | ||
server.stop_worker(worker) | ||
server.check_not_responding | ||
server.reload | ||
expect(server.miq_workers).to be_empty | ||
expect { worker.reload }.to raise_error(ActiveRecord::RecordNotFound) | ||
end | ||
|
||
it "monitors recently heartbeated 'stopping' workers" do | ||
worker.update(:last_heartbeat => 1.minute.ago) | ||
server.stop_worker(worker) | ||
server.check_not_responding | ||
server.reload | ||
expect(server.miq_workers.first.id).to eq(worker.id) | ||
end | ||
end | ||
end |
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