Skip to content

Commit

Permalink
Test all the refresh settings by the AWS stubbed refreshers
Browse files Browse the repository at this point in the history
Test all the refresh settings by the AWS stubbed refreshers
  • Loading branch information
Ladas committed Aug 11, 2017
1 parent 3c2529b commit 9826239
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require_relative '../aws_helper'
require_relative '../aws_stubs'
require_relative '../aws_refresher_spec_common'

describe ManageIQ::Providers::Amazon::NetworkManager::Refresher do
include AwsRefresherSpecCommon
include AwsStubs

describe "refresh" do
Expand All @@ -12,21 +14,18 @@
EvmSpecHelper.local_miq_server(:zone => Zone.seed)
end

# Test all kinds of refreshes, DTO refresh, DTO with batch saving and the original refresh
[{:inventory_object_refresh => true},
{:inventory_object_saving_strategy => :recursive, :inventory_object_refresh => true},
{:inventory_object_refresh => false}].each do |inventory_object_settings|
context "with settings #{inventory_object_settings}" do
(AwsRefresherSpecCommon::ALL_GRAPH_REFRESH_SETTINGS + AwsRefresherSpecCommon::ALL_OLD_REFRESH_SETTINGS
).each do |settings|
context "with settings #{settings}" do
before :each do
settings = OpenStruct.new
settings.inventory_object_refresh = inventory_object_settings[:inventory_object_refresh]
settings.inventory_object_saving_strategy = inventory_object_settings[:inventory_object_saving_strategy]
settings.get_private_images = true
settings.get_shared_images = false
settings.get_public_images = false

allow(Settings.ems_refresh).to receive(:ec2).and_return(settings)
@inventory_object_settings = inventory_object_settings
stub_refresh_settings(
settings.merge(
:get_private_images => true,
:get_shared_images => false,
:get_public_images => false
)
)
@inventory_object_settings = settings
end

it "2 refreshes, first creates all entities, second updates all entitites" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require_relative '../aws_helper'
require_relative '../aws_stubs'
require_relative '../aws_refresher_spec_common'

describe ManageIQ::Providers::Amazon::NetworkManager::Refresher do
include AwsRefresherSpecCommon
include AwsStubs

describe "refresh" do
Expand All @@ -13,12 +15,11 @@
end

# Test all kinds of refreshes, DTO refresh, DTO with batch saving and the original refresh
[{:inventory_object_refresh => true},
{:inventory_object_saving_strategy => :recursive, :inventory_object_refresh => true},
{:inventory_object_refresh => false}].each do |settings|
(AwsRefresherSpecCommon::ALL_GRAPH_REFRESH_SETTINGS + AwsRefresherSpecCommon::ALL_OLD_REFRESH_SETTINGS
).each do |settings|
context "with settings #{settings}" do
before :each do
allow(Settings.ems_refresh).to receive(:ec2_network).and_return(settings)
stub_refresh_settings(settings)
end

it "2 refreshes, first creates all entities, second updates all entitites" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require_relative '../../aws_helper'
require_relative '../../aws_stubs'
require_relative '../../aws_refresher_spec_common'

describe ManageIQ::Providers::Amazon::StorageManager::Ebs::Refresher do
include AwsRefresherSpecCommon
include AwsStubs

describe "refresh" do
Expand All @@ -16,13 +18,11 @@
FactoryGirl.create(:vm_amazon, :ext_management_system => @ems, :ems_ref => "instance_0", :hardware => hardware)
end

# Test all kinds of refreshes, DTO refresh, DTO with batch saving and the original refresh
[{:inventory_object_refresh => true},
{:inventory_object_saving_strategy => :recursive, :inventory_object_refresh => true},
{:inventory_object_refresh => false}].each do |settings|
(AwsRefresherSpecCommon::ALL_GRAPH_REFRESH_SETTINGS + AwsRefresherSpecCommon::ALL_OLD_REFRESH_SETTINGS
).each do |settings|
context "with settings #{settings}" do
before :each do
allow(Settings.ems_refresh).to receive(:ec2_ebs_storage).and_return(settings)
stub_refresh_settings(settings)
end

it "2 refreshes, first creates all entities, second updates all entitites" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
require_relative '../../aws_helper'
require_relative '../../aws_stubs'
require_relative '../../aws_refresher_spec_common'

describe ManageIQ::Providers::Amazon::StorageManager::S3::Refresher do
include AwsRefresherSpecCommon
include AwsStubs

before do
stub_settings_merge(:prototype => {:amazon => {:s3 => true }})

skip("AWS S3 is disabled") unless ::Settings.prototype.amazon.s3
EvmSpecHelper.local_miq_server(:zone => Zone.seed)
end
Expand All @@ -17,13 +21,11 @@
end

describe "refresh" do
# Test all kinds of refreshes
[{:inventory_object_refresh => true},
{:inventory_object_saving_strategy => :recursive, :inventory_object_refresh => true},
{:inventory_object_refresh => false}].each do |settings|
(AwsRefresherSpecCommon::ALL_GRAPH_REFRESH_SETTINGS + AwsRefresherSpecCommon::ALL_OLD_REFRESH_SETTINGS
).each do |settings|
context "with settings #{settings}" do
before :each do
allow(Settings.ems_refresh).to receive(:s3).and_return(settings)
stub_refresh_settings(settings)
end

it "2 refreshes, first creates all entities, second updates all entitites" do
Expand Down

0 comments on commit 9826239

Please sign in to comment.