Add Elasticsearch cluster health check and indexes mismatch check to dashboard (#26448)
This commit is contained in:
parent
9ed0c91a37
commit
ac0eb0533e
4 changed files with 105 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue