Skip to content

Commit

Permalink
Correct ems_type for provider refreshers
Browse files Browse the repository at this point in the history
This fix will allow provider refreshers to correctly retieve vmdb configuration options.

Fixes ManageIQ#5816
  • Loading branch information
jvlcek committed Dec 16, 2015
1 parent 982e456 commit b6f12f8
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/models/manageiq/providers/base_manager/refresher.rb
Expand Up @@ -26,8 +26,7 @@ def refresher_options
private

def self.ems_type
# e.g. ManageIQ::Providers::Vmware::InfraManager::Refresher => :vmware
@ems_type ||= parent.short_token.underscore.to_sym
@ems_type ||= parent.ems_type.to_sym
end

def group_targets_by_ems(targets)
Expand Down
Expand Up @@ -7,6 +7,10 @@
@ems.update_authentication(:default => {:userid => "0123456789ABCDEFGHIJ", :password => "ABCDEFGHIJKLMNO1234567890abcdefghijklmno"})
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:ec2)
end

it "will perform a full refresh" do
2.times do # Run twice to verify that a second run with existing data does not change anything
@ems.reload
Expand Down
@@ -1,7 +1,7 @@
require "spec_helper"
require 'azure-armrest'

describe ManageIQ::Providers::Azure::CloudManager do
describe ManageIQ::Providers::Azure::CloudManager::Refresher do
before(:each) do
_guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone
@ems = FactoryGirl.create(:ems_azure, :zone => zone, :provider_region => "eastus")
Expand All @@ -21,6 +21,10 @@ def join; end
end
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:azure)
end

it "will perform a full refresh" do
2.times do # Run twice to verify that a second run with existing data does not change anything
@ems.reload
Expand Down
Expand Up @@ -37,6 +37,10 @@
let(:my_env) { environments.reverse.find { |a| a.name = 'production' } }
let(:my_arch) { architectures.reverse.find { |a| a.name = 'x86_64' } }

it ".ems_type" do
expect(described_class.ems_type).to eq(:foreman_configuration)
end

it "will perform a full refresh on api v2" do
# Stub the queueing of the refresh so that when the manager
# queues up an alternate refresh we will execute it immediately.
Expand Down
Expand Up @@ -17,6 +17,10 @@
:uid_ems => 'cad16607-fb88-4412-a993-5242030f6afa')
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:kubernetes)
end

it "will perform a full refresh on k8s" do
2.times do # Run twice to verify that a second run with existing data does not change anything
VCR.use_cassette("#{described_class.name.underscore}") do # , :record => :new_episodes) do
Expand Down
Expand Up @@ -25,6 +25,10 @@
WinRM::WinRMWebService.any_instance.stub(:run_powershell_script => output)
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:scvmm)
end

it "will perform a full refresh" do
2.times do # Run twice to verify that a second run with existing data does not change anything
@ems.reload
Expand Down
Expand Up @@ -6,6 +6,10 @@
@ems = FactoryGirl.create(:ems_openshift, :hostname => "10.35.0.174")
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:openshift)
end

it "will perform a full refresh on openshift" do
2.times do
@ems.reload
Expand Down
@@ -0,0 +1,7 @@
require "spec_helper"

describe ManageIQ::Providers::Openstack::CloudManager::Refresher do
it ".ems_type" do
expect(described_class.ems_type).to eq(:openstack)
end
end
@@ -0,0 +1,7 @@
require "spec_helper"

describe ManageIQ::Providers::Openstack::InfraManager::Refresher do
it ".ems_type" do
expect(described_class.ems_type).to eq(:openstack_infra)
end
end
Expand Up @@ -7,6 +7,10 @@
@ems.update_authentication(:default => {:userid => "evm@manageiq.com", :password => "password"})
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:rhevm)
end

it "will perform a full refresh on v3.0" do
VCR.use_cassette("#{described_class.name.underscore}_3_0") do
EmsRefresh.refresh(@ems)
Expand Down
Expand Up @@ -7,6 +7,10 @@
@ems.update_authentication(:default => {:userid => "evm@manageiq.com", :password => "password"})
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:rhevm)
end

it "will perform a full refresh on v3.1" do
VCR.use_cassette("#{described_class.name.underscore}_3_1") do
EmsRefresh.refresh(@ems)
Expand Down
Expand Up @@ -14,6 +14,10 @@
.to receive(:has_credentials?).and_return(true)
end

it ".ems_type" do
expect(described_class.ems_type).to eq(:vmwarews)
end

it "will perform a full refresh" do
EmsRefresh.refresh(@ems)
@ems.reload
Expand Down

0 comments on commit b6f12f8

Please sign in to comment.