Skip to content

Commit

Permalink
Refs #36801: Set Redis as the default cache on upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Oct 5, 2023
1 parent 4462c6d commit 4e27021
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if answers['foreman'].is_a?(Hash) && answers['foreman']['rails_cache_store'] == {'type' => 'file'}
answers['foreman']['rails_cache_store'] = {'type' => 'redis'}
end
3 changes: 3 additions & 0 deletions config/katello.migrations/231005004311-redis-default-cache.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if answers['foreman'].is_a?(Hash) && answers['foreman']['rails_cache_store'] == {'type' => 'file'}
answers['foreman']['rails_cache_store'] = {'type' => 'redis'}
end
18 changes: 18 additions & 0 deletions spec/migration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,21 @@
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

0 comments on commit 4e27021

Please sign in to comment.