Drop redis namespace code (except for Rails cache) (#34665)

This commit is contained in:
Claire 2025-05-20 15:02:09 +02:00 committed by GitHub
parent f94b1fce41
commit 6d6263ce07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 66 deletions

View file

@ -26,20 +26,6 @@ RSpec.describe Mastodon::RedisConfiguration do
end
end
shared_examples 'setting a namespace' do
context 'when setting the `REDIS_NAMESPACE` variable' do
around do |example|
ClimateControl.modify REDIS_NAMESPACE: 'testns' do
example.run
end
end
it 'uses the value for the namespace' do
expect(subject[:namespace]).to eq 'testns'
end
end
end
shared_examples 'secondary configuration' do |prefix|
context "when no `#{prefix}_REDIS_` environment variables are present" do
it 'uses the url from the base config' do
@ -208,7 +194,6 @@ RSpec.describe Mastodon::RedisConfiguration do
end
it_behaves_like 'setting a different driver'
it_behaves_like 'setting a namespace'
it_behaves_like 'sentinel support'
end
@ -217,7 +202,6 @@ RSpec.describe Mastodon::RedisConfiguration do
it_behaves_like 'secondary configuration', 'SIDEKIQ'
it_behaves_like 'setting a different driver'
it_behaves_like 'setting a namespace'
it_behaves_like 'sentinel support', 'SIDEKIQ'
end
@ -238,22 +222,8 @@ RSpec.describe Mastodon::RedisConfiguration do
})
end
context 'when `REDIS_NAMESPACE` is not set' do
it 'uses the `cache` namespace' do
expect(subject[:namespace]).to eq 'cache'
end
end
context 'when setting the `REDIS_NAMESPACE` variable' do
around do |example|
ClimateControl.modify REDIS_NAMESPACE: 'testns' do
example.run
end
end
it 'attaches the `_cache` postfix to the namespace' do
expect(subject[:namespace]).to eq 'testns_cache'
end
it 'uses the `cache` namespace' do
expect(subject[:namespace]).to eq 'cache'
end
it_behaves_like 'secondary configuration', 'CACHE'

View file

@ -17,7 +17,7 @@ class StreamingServerManager
@running_thread = Thread.new do
Open3.popen2e(
{
'REDIS_NAMESPACE' => REDIS_CONFIGURATION.base[:namespace],
'REDIS_DB' => (ENV.fetch('TEST_ENV_NUMBER', 0).to_i + 1).to_s,
'DB_NAME' => "#{ENV.fetch('DB_NAME', 'mastodon')}_test#{ENV.fetch('TEST_ENV_NUMBER', '')}",
'RAILS_ENV' => ENV.fetch('RAILS_ENV', 'test'),
'NODE_ENV' => ENV.fetch('STREAMING_NODE_ENV', 'development'),