-
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 #18085 from d-m-u/adding_tests_for_retire_tasks
Test deliver_to_automate gets called in vms, services, orch stack retire tasks (cherry picked from commit 9822d52)
- Loading branch information
Showing
7 changed files
with
72 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe OrchestrationStackRetireTask do | ||
let(:user) { FactoryGirl.create(:user_with_group) } | ||
let(:orchestration_stack) { FactoryGirl.create(:orchestration_stack) } | ||
let(:miq_request) { FactoryGirl.create(:orchestration_stack_retire_request, :requester => user) } | ||
let(:orchestration_stack_retire_task) { FactoryGirl.create(:orchestration_stack_retire_task, :source => orchestration_stack, :miq_request => miq_request, :options => {:src_ids => [orchestration_stack.id] }) } | ||
let(:approver) { FactoryGirl.create(:user_miq_request_approver) } | ||
|
||
it "should initialize properly" do | ||
expect(orchestration_stack_retire_task).to have_attributes(:state => "pending", :status => "Ok") | ||
end | ||
|
||
describe "deliver_to_automate" do | ||
before do | ||
allow(MiqServer).to receive(:my_zone).and_return(Zone.seed.name) | ||
miq_request.approve(approver, "why not??") | ||
end | ||
|
||
it "updates the task state to pending" do | ||
expect(orchestration_stack_retire_task).to receive(:update_and_notify_parent).with( | ||
:state => 'pending', | ||
:status => 'Ok', | ||
:message => 'Automation Starting' | ||
) | ||
orchestration_stack_retire_task.deliver_to_automate | ||
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
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,27 @@ | ||
describe VmRetireTask do | ||
let(:user) { FactoryGirl.create(:user_with_group) } | ||
let(:vm) { FactoryGirl.create(:vm) } | ||
let(:miq_request) { FactoryGirl.create(:vm_retire_request, :requester => user) } | ||
let(:vm_retire_task) { FactoryGirl.create(:vm_retire_task, :source => vm, :miq_request => miq_request, :options => {:src_ids => [vm.id] }) } | ||
let(:approver) { FactoryGirl.create(:user_miq_request_approver) } | ||
|
||
it "should initialize properly" do | ||
expect(vm_retire_task).to have_attributes(:state => 'pending', :status => 'Ok') | ||
end | ||
|
||
describe "deliver_to_automate" do | ||
before do | ||
allow(MiqServer).to receive(:my_zone).and_return(Zone.seed.name) | ||
miq_request.approve(approver, "why not??") | ||
end | ||
|
||
it "updates the task state to pending" do | ||
expect(vm_retire_task).to receive(:update_and_notify_parent).with( | ||
:state => 'pending', | ||
:status => 'Ok', | ||
:message => 'Automation Starting' | ||
) | ||
vm_retire_task.deliver_to_automate | ||
end | ||
end | ||
end |