Skip to content

Commit

Permalink
Merge pull request #18488 from lpichler/delegate_vms_and_templates_to…
Browse files Browse the repository at this point in the history
…_parent_manager_in_NetworkManager

Delegate vms_and_templates and miq_templates to parent_manager
  • Loading branch information
gtanzillo authored Mar 5, 2019
2 parents c9ae719 + ec2d5d0 commit 0f3be1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/network_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class << model_name
:resource_groups,
:vms,
:total_vms,
:vms_and_templates,
:total_vms_and_templates,
:miq_templates,
:total_miq_templates,
:hosts,
:to => :parent_manager,
:allow_nil => true
Expand Down
16 changes: 16 additions & 0 deletions spec/models/manageiq/providers/network_manager_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
describe ManageIQ::Providers::NetworkManager do
let(:vms) { FactoryBot.create(:vm) }
let(:template) { FactoryBot.create(:miq_template) }

let(:ems) { FactoryBot.create(:ems_openstack, :vms => [vms], :miq_templates => [template]) }

it "delegates vms and templates to parent manager (ExtManagementSystem)" do
expect(ems.id).not_to eq(ems.network_manager.id)
expect(ems.vms).to match_array([vms])
expect(ems.network_manager.vms).to match_array([vms])
expect(ems.miq_templates).to match_array([template])
expect(ems.network_manager.miq_templates).to match_array([template])
expect(ems.vms_and_templates).to match_array([vms, template])
expect(ems.network_manager.vms_and_templates).to match_array([vms, template])
end
end

0 comments on commit 0f3be1d

Please sign in to comment.