Skip to content

Commit

Permalink
Clean up tests, remove reference to old configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mansam committed Oct 11, 2017
1 parent 6fc916f commit 07f7164
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def vms
end

def vms_by_id
@vms_by_id ||= Hash[vms.collect { |s| [s.id, s] }]
@vms_by_id ||= vms.index_by(&:id)
end

def tenants
Expand Down Expand Up @@ -152,7 +152,7 @@ def volume_templates
end

def volumes_by_id
@volumes_by_id ||= Hash[volume_templates.collect { |f| [f.id, f] }]
@volumes_by_id ||= volume_templates.index_by(&:id)
end

def volume_snapshot_templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ def assert_table_counts
expect(CloudSubnet.count).to eq network_data.subnets.count
expect(NetworkRouter.count).to eq network_data.routers.count
expect(CloudVolume.count).to eq volumes_count
if ::Settings.ems.ems_openstack.try(:refresh).try(:inventory_object_refresh) || ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(VmOrTemplate.count).to eq vms_count + images_count + volume_and_snapshot_templates_count
if ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(VmOrTemplate.count).to eq vms_count + images_count + volume_and_snapshot_templates_count
else
expect(VmOrTemplate.count).to eq vms_count + images_count
expect(VmOrTemplate.count).to eq vms_count + images_count
end
expect(Vm.count).to eq vms_count
if ::Settings.ems.ems_openstack.try(:refresh).try(:inventory_object_refresh) || ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(MiqTemplate.count).to eq images_count + volume_and_snapshot_templates_count
if ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(MiqTemplate.count).to eq images_count + volume_and_snapshot_templates_count
else
expect(MiqTemplate.count).to eq images_count
expect(MiqTemplate.count).to eq images_count
end
expect(Disk.count).to eq disks_count
# One hardware per each VM
Expand Down Expand Up @@ -303,24 +303,24 @@ def assert_ems
:uid_ems => identity_service == :v3 ? 'default' : nil
)

expect(@ems.flavors.size).to eq compute_data.flavors.count
expect(@ems.availability_zones.size).to eq availability_zones_count
expect(@ems.floating_ips.size).to eq network_data.floating_ips.sum
expect(@ems.key_pairs.size).to eq compute_data.key_pairs.count
expect(@ems.flavors.size).to eq compute_data.flavors.count
expect(@ems.availability_zones.size).to eq availability_zones_count
expect(@ems.floating_ips.size).to eq network_data.floating_ips.sum
expect(@ems.key_pairs.size).to eq compute_data.key_pairs.count
security_groups_count = @ems.security_groups.count { |x| x.name != 'default' }
expect(security_groups_count).to eq security_groups_count
if ::Settings.ems.ems_openstack.try(:refresh).try(:inventory_object_refresh) || ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(@ems.vms_and_templates.size).to eq vms_count + images_count + volume_and_snapshot_templates_count
expect(security_groups_count).to eq security_groups_count
if ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(@ems.vms_and_templates.size).to eq vms_count + images_count + volume_and_snapshot_templates_count
else
expect(@ems.vms_and_templates.size).to eq vms_count + images_count
expect(@ems.vms_and_templates.size).to eq vms_count + images_count
end
expect(@ems.vms.size).to eq vms_count
if ::Settings.ems.ems_openstack.try(:refresh).try(:inventory_object_refresh) || ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(@ems.miq_templates.size).to eq images_count + volume_and_snapshot_templates_count
expect(@ems.vms.size).to eq vms_count
if ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh)
expect(@ems.miq_templates.size).to eq images_count + volume_and_snapshot_templates_count
else
expect(@ems.miq_templates.size).to eq images_count
expect(@ems.miq_templates.size).to eq images_count
end
expect(@ems.cloud_networks.size).to eq network_data.networks.count
expect(@ems.cloud_networks.size).to eq network_data.networks.count

if neutron_networking?
expect(@ems.public_networks.first).to be_kind_of(ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork::Public)
Expand Down

0 comments on commit 07f7164

Please sign in to comment.