Merge remote-tracking branch 'parent/main' into kb_migration

This commit is contained in:
KMY 2023-08-22 13:03:50 +09:00
commit e656ab15a1
21 changed files with 617 additions and 115 deletions

View file

@ -11,7 +11,25 @@ describe Admin::SystemCheck::ElasticsearchCheck do
describe 'pass?' do
context 'when chewy is enabled' do
before { allow(Chewy).to receive(:enabled?).and_return(true) }
before do
allow(Chewy).to receive(:enabled?).and_return(true)
allow(Chewy.client.cluster).to receive(:health).and_return({ 'status' => 'green', 'number_of_nodes' => 1 })
allow(Chewy.client.indices).to receive(:get_mapping).and_return({
AccountsIndex.index_name => AccountsIndex.mappings_hash.deep_stringify_keys,
StatusesIndex.index_name => StatusesIndex.mappings_hash.deep_stringify_keys,
InstancesIndex.index_name => InstancesIndex.mappings_hash.deep_stringify_keys,
TagsIndex.index_name => TagsIndex.mappings_hash.deep_stringify_keys,
})
allow(Chewy.client.indices).to receive(:get_settings).and_return({
'chewy_specifications' => {
'settings' => {
'index' => {
'number_of_replicas' => 0,
},
},
},
})
end
context 'when running version is present and high enough' do
before do
@ -67,8 +85,19 @@ describe Admin::SystemCheck::ElasticsearchCheck do
end
describe 'message' do
before do
allow(Chewy).to receive(:enabled?).and_return(true)
allow(Chewy.client.cluster).to receive(:health).and_return({ 'status' => 'green', 'number_of_nodes' => 1 })
allow(Chewy.client.indices).to receive(:get_mapping).and_return({
AccountsIndex.index_name => AccountsIndex.mappings_hash.deep_stringify_keys,
StatusesIndex.index_name => StatusesIndex.mappings_hash.deep_stringify_keys,
InstancesIndex.index_name => InstancesIndex.mappings_hash.deep_stringify_keys,
TagsIndex.index_name => TagsIndex.mappings_hash.deep_stringify_keys,
})
end
context 'when running version is present' do
before { allow(Chewy.client).to receive(:info).and_return({ 'version' => { 'number' => '999.99.9' } }) }
before { allow(Chewy.client).to receive(:info).and_return({ 'version' => { 'number' => '1.2.3' } }) }
it 'sends class name symbol to message instance' do
allow(Admin::SystemCheck::Message).to receive(:new)
@ -77,7 +106,7 @@ describe Admin::SystemCheck::ElasticsearchCheck do
check.message
expect(Admin::SystemCheck::Message).to have_received(:new)
.with(:elasticsearch_version_check, 'Elasticsearch 999.99.9 is running while 7.x is required')
.with(:elasticsearch_version_check, 'Elasticsearch 1.2.3 is running while 7.x is required')
end
end

View file

@ -94,19 +94,5 @@ RSpec.describe 'Deleting profile images' do
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
end
end
context 'when provided picture value is invalid' do
it 'returns http bad request' do
delete '/api/v1/profile/invalid', headers: headers
expect(response).to have_http_status(400)
end
it 'does not queue up an account update distribution' do
delete '/api/v1/profile/invalid', headers: headers
expect(ActivityPub::UpdateDistributionWorker).to_not have_received(:perform_async).with(account.id)
end
end
end
end