Skip to content

Commit

Permalink
Delete also vms_and_templates and miq_templates to parent_manager in …
Browse files Browse the repository at this point in the history
…NetworkManager
  • Loading branch information
lpichler committed Feb 27, 2019
1 parent 2cbc654 commit ec2d5d0
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 ec2d5d0

Please sign in to comment.