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#16705 from bzwei/migrate_with_error
Rescue migration error and update status (cherry picked from commit 805e023) https://bugzilla.redhat.com/show_bug.cgi?id=1478518
- Loading branch information
1 parent
82b843c
commit 67dee1e
Showing
2 changed files
with
28 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe VmMigrateTask do | ||
describe '.do_request' do | ||
let(:vm) { Vm.new } | ||
before { subject.vm = vm } | ||
|
||
it 'migrates the vm and updates the status' do | ||
expect(vm).to receive(:migrate) | ||
expect(subject).to receive(:update_and_notify_parent).with(hash_including(:state => 'migrated')) | ||
subject.do_request | ||
end | ||
|
||
it 'catches migrate error and update the status' do | ||
expect(vm).to receive(:migrate).and_raise("Bad things happened") | ||
expect(subject).to receive(:update_and_notify_parent).with(hash_including(:state => 'finished', :status => 'error', :message => 'Failed. Reason[Bad things happened]')) | ||
subject.do_request | ||
end | ||
end | ||
end |