Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed call that build list of Storages to build Host file drop down
Issue was introduced in #3956, in commit 6df12d1 code that builds Host file drop down was changed `vm.try(:available_iso_names)` was removed and new method `get_iso_options` was added to build the list. Changed to get all storages that the vm's host is attached to instead of all of the vm's storages Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1689369
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 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
28 changes: 28 additions & 0 deletions
28
spec/controllers/mixins/actions/vm_actions/reconfigure_spec.rb
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,28 @@ | ||
describe Mixins::Actions::VmActions::Reconfigure do | ||
describe '#get_iso_options' do | ||
before do | ||
@vm = FactoryBot.create(:vm_vmware) | ||
@host = FactoryBot.create(:host, :name =>'hostname1') | ||
@datastore = FactoryBot.create(:storage, :name => 'storage_name') | ||
@vm.host = @host | ||
FactoryBot.create(:storage_file, :storage_id => @datastore.id, :ext_name => 'iso', :base_name => "good-stuff.iso") | ||
FactoryBot.create(:storage_file, :storage_id => 1, :ext_name => 'iso', :base_name => "some_other_storage.iso") | ||
end | ||
|
||
context 'populate list of Host files' do | ||
let(:controller) { VmInfraController.new } | ||
|
||
it "gets list of VM's host storages that have iso files" do | ||
@host.storages << @datastore | ||
storage_list = controller.send(:get_iso_options, @vm) | ||
expect(storage_list.count).to be(1) | ||
end | ||
|
||
it "gets empty list for VM's storage" do | ||
@vm.storages << @datastore | ||
storage_list = controller.send(:get_iso_options, @vm) | ||
expect(storage_list.count).to be(0) | ||
end | ||
end | ||
end | ||
end |