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

Split migration spec into separate files #959

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
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
115 changes: 0 additions & 115 deletions spec/migration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,118 +26,3 @@
end
end
end

migration '20210625142707_dynamic_puppet_in_foreman_groups' do
let(:answers) do
{
'foreman' => {
'user_groups' => ['puppet'],
},
}
end

scenarios %w[foreman katello] do
it 'removes puppet' do
expect(migrated_answers['foreman']['user_groups']).to eq []
end
end
end

migration '200818160950-remove_tuning_fact' do
scenarios %w[foreman-proxy-content] do
let(:config) { super().merge(:facts => { 'tuning' => 'default' }) }

it 'removes facts' do
expect(migrated_config).not_to include(:facts)
end
end
end

migration '20210929144850_disable_puppet_plugins_if_undesired' do
let(:answers) do
{
'foreman' => false,
'foreman::cli' => false,
}
end

scenarios %w[foreman katello] do
it 'keeps foreman::cli disabled' do
expect(migrated_answers['foreman::cli']).to be false
end

it 'adds foreman::cli::puppet disabled' do
expect(migrated_answers['foreman::cli::puppet']).to be false
end

it 'keeps foreman disabled' do
expect(migrated_answers['foreman']).to be false
end

it 'adds foreman::plugin::puppet disabled' do
expect(migrated_answers['foreman::plugin::puppet']).to be false
end
end
end

migration '20211108174119_disable_registration_without_templates' do
scenarios %w[foreman foreman-proxy-content katello] do
context 'with registration, without templates' do
let(:answers) do
{
'foreman_proxy' => {
'registration' => true,
'templates' => false,
},
}
end

it 'disables registration' do
expect(migrated_answers['foreman_proxy']['registration']).to be false
end
end

context 'with registration, with templates' do
let(:answers) do
{
'foreman_proxy' => {
'registration' => true,
'templates' => true,
},
}
end

it 'keeps registration enabled' do
expect(migrated_answers['foreman_proxy']['registration']).to be true
end
end
end
end

migration '181213211252-merged-installer' do
let(:config) { load_fixture_yaml('merged-installer', "#{scenario_name}-before.yaml") }

scenarios %w[foreman-proxy-content katello] do
it 'matches the scenario fixture' do
expect(migrated_config).to eq load_fixture_yaml('merged-installer', "#{scenario_name}-after.yaml")
end
end
end

migration '20231005004305_redis_default_cache' do
scenarios %w[foreman katello] do
context 'changes default cache to Redis' do
let(:answers) do
{
'foreman' => {
'rails_cache_store' => { 'type' => 'file' },
},
}
end

it 'changes the default to Redis' do
expect(migrated_answers['foreman']['rails_cache_store']).to eq({ 'type' => 'redis' })
end
end
end
end
11 changes: 11 additions & 0 deletions spec/migrations/181213211252-merged-installer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

migration '181213211252-merged-installer' do
let(:config) { load_fixture_yaml('merged-installer', "#{scenario_name}-before.yaml") }

scenarios %w[foreman-proxy-content katello] do
it 'matches the scenario fixture' do
expect(migrated_config).to eq load_fixture_yaml('merged-installer', "#{scenario_name}-after.yaml")
end
end
end
11 changes: 11 additions & 0 deletions spec/migrations/200818160950-remove_tuning_fact_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

migration '200818160950-remove_tuning_fact' do
scenarios %w[foreman-proxy-content] do
let(:config) { super().merge(:facts => { 'tuning' => 'default' }) }

it 'removes facts' do
expect(migrated_config).not_to include(:facts)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

migration '20210625142707_dynamic_puppet_in_foreman_groups' do
let(:answers) do
{
'foreman' => {
'user_groups' => ['puppet'],
},
}
end

scenarios %w[foreman katello] do
it 'removes puppet' do
expect(migrated_answers['foreman']['user_groups']).to eq []
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

migration '20210929144850_disable_puppet_plugins_if_undesired' do
let(:answers) do
{
'foreman' => false,
'foreman::cli' => false,
}
end

scenarios %w[foreman katello] do
it 'keeps foreman::cli disabled' do
expect(migrated_answers['foreman::cli']).to be false
end

it 'adds foreman::cli::puppet disabled' do
expect(migrated_answers['foreman::cli::puppet']).to be false
end

it 'keeps foreman disabled' do
expect(migrated_answers['foreman']).to be false
end

it 'adds foreman::plugin::puppet disabled' do
expect(migrated_answers['foreman::plugin::puppet']).to be false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'spec_helper'

migration '20211108174119_disable_registration_without_templates' do
scenarios %w[foreman foreman-proxy-content katello] do
context 'with registration, without templates' do
let(:answers) do
{
'foreman_proxy' => {
'registration' => true,
'templates' => false,
},
}
end

it 'disables registration' do
expect(migrated_answers['foreman_proxy']['registration']).to be false
end
end

context 'with registration, with templates' do
let(:answers) do
{
'foreman_proxy' => {
'registration' => true,
'templates' => true,
},
}
end

it 'keeps registration enabled' do
expect(migrated_answers['foreman_proxy']['registration']).to be true
end
end
end
end
19 changes: 19 additions & 0 deletions spec/migrations/20231005004305_redis_default_cache_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

migration '20231005004305_redis_default_cache' do
scenarios %w[foreman katello] do
context 'changes default cache to Redis' do
let(:answers) do
{
'foreman' => {
'rails_cache_store' => { 'type' => 'file' },
},
}
end

it 'changes the default to Redis' do
expect(migrated_answers['foreman']['rails_cache_store']).to eq({ 'type' => 'redis' })
end
end
end
end