Skip to content

Commit

Permalink
Merge pull request #20031 from skateman/provider-factories
Browse files Browse the repository at this point in the history
Set the provider attribute before hostname/ipaddress in EMS factory
  • Loading branch information
agrare authored Mar 31, 2020
2 parents beea070 + ca3e508 commit d20bbb4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions spec/factories/ext_management_system.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FactoryBot.define do
factory :ext_management_system,
:class => "ManageIQ::Providers::Vmware::InfraManager" do
# The provider has to be set before the hostname/ipaddress sequences as in some cases these attributes
# might be delegated to the provider. As the attributes are being set based on the order in this file,
# it is important to keep this line at the beginning of the factory.
provider { nil }

sequence(:name) { |n| "ems_#{seq_padded_for_sorting(n)}" }
sequence(:hostname) { |n| "ems-#{seq_padded_for_sorting(n)}" }
sequence(:ipaddress) { |n| ip_from_seq(n) }
Expand Down Expand Up @@ -92,8 +97,6 @@
parent_manager { FactoryBot.create(:ext_management_system) }
end



factory :ems_storage,
:aliases => ["manageiq/providers/storage_manager"],
:class => "ManageIQ::Providers::StorageManager::SwiftManager",
Expand Down Expand Up @@ -333,7 +336,6 @@
end
end


factory :ems_openshift,
:aliases => ["manageiq/providers/openshift/container_manager"],
:class => "ManageIQ::Providers::Openshift::ContainerManager",
Expand All @@ -344,7 +346,9 @@
factory :configuration_manager_foreman,
:aliases => ["manageiq/providers/foreman/configuration_manager"],
:class => "ManageIQ::Providers::Foreman::ConfigurationManager",
:parent => :configuration_manager
:parent => :configuration_manager do
provider :factory => :provider_foreman
end

trait(:provider) do
after(:build, &:create_provider)
Expand Down Expand Up @@ -376,5 +380,7 @@
factory :provisioning_manager_foreman,
:aliases => ["manageiq/providers/foreman/provisioning_manager"],
:class => "ManageIQ::Providers::Foreman::ProvisioningManager",
:parent => :provisioning_manager
:parent => :provisioning_manager do
provider :factory => :provider_foreman
end
end

0 comments on commit d20bbb4

Please sign in to comment.