Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the provider attribute before hostname/ipaddress in EMS factory #20031

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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