Skip to content

Commit

Permalink
Merge pull request #471 from Ladas/move_vm_reconnect_spec_to_acorrect…
Browse files Browse the repository at this point in the history
…_location

Move vm_reconnect spec to a correct location
  • Loading branch information
agrare committed Aug 1, 2018
2 parents eaf0c12 + a54c067 commit 90afad7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
include AwsRefresherSpecCommon
include AwsRefresherSpecCounts

before(:each) do
@ems = FactoryGirl.create(:ems_amazon_with_vcr_authentication)
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:ec2)
end
Expand All @@ -18,6 +14,8 @@
before(:each) do
stub_refresh_settings(settings)
create_tag_mapping

@ems = FactoryGirl.create(:ems_amazon_with_vcr_authentication)
end

it "will perform a full refresh" do
Expand All @@ -39,9 +37,39 @@
end
end

it 'pickups existing Vm and MiqTemplate records on Amazon EMS re-adding' do
ems = new_amazon_ems

VCR.use_cassette(described_class.name.underscore + '_vm_reconnect') do
expect { EmsRefresh.refresh(ems) }.to change { VmOrTemplate.count }.from(0)
end

expect { ems.destroy }.to_not change { VmOrTemplate.count }

aggregate_failures do
expect(Vm.count).to_not be_zero
expect(MiqTemplate.count).to_not be_zero
expect(ExtManagementSystem.count).to be_zero
end

ems = new_amazon_ems

VCR.use_cassette(described_class.name.underscore + '_vm_reconnect') do
expect { EmsRefresh.refresh(ems) }
.to change { VmOrTemplate.distinct.pluck(:ems_id) }.from([nil]).to([ems.id])
.and change { VmOrTemplate.count }.by(0)
.and change { MiqTemplate.count }.by(0)
.and change { Vm.count }.by(0)
end
end

def table_counts_from_api
counts = super
counts[:flavor] = counts[:flavor] + 4 # Graph refresh collect all flavors, not filtering them by known_flavors
counts
end

def new_amazon_ems
FactoryGirl.create(:ems_amazon_with_vcr_authentication, :provider_region => 'eu-central-1')
end
end
37 changes: 0 additions & 37 deletions spec/models/manager_refresh/inventory_collection_default_spec.rb

This file was deleted.

0 comments on commit 90afad7

Please sign in to comment.