Commit d1f225fe authored by Adrien Kohlbecker's avatar Adrien Kohlbecker Committed by Bob Van Landuyt

Use available? method for Elastic Stack availability

parent d29eb15a
...@@ -78,7 +78,7 @@ module EE ...@@ -78,7 +78,7 @@ module EE
end end
def elastic_stack_available? def elastic_stack_available?
!!deployment_platform&.cluster&.application_elastic_stack&.installed? !!deployment_platform&.cluster&.application_elastic_stack&.available?
end end
private private
......
...@@ -229,4 +229,39 @@ describe Environment, :use_clean_rails_memory_store_caching do ...@@ -229,4 +229,39 @@ describe Environment, :use_clean_rails_memory_store_caching do
end end
end end
end end
describe '#elastic_stack_available?' do
let!(:cluster) { create(:cluster, :project, :provided_by_user, projects: [project]) }
let!(:deployment) { create(:deployment, :success, environment: environment, project: project) }
context 'when app does not exist' do
it 'returns false' do
expect(environment.elastic_stack_available?).to be(false)
end
end
context 'when app exists' do
let!(:application) { create(:clusters_applications_elastic_stack, cluster: cluster) }
it 'returns false' do
expect(environment.elastic_stack_available?).to be(false)
end
end
context 'when app is installed' do
let!(:application) { create(:clusters_applications_elastic_stack, :installed, cluster: cluster) }
it 'returns true' do
expect(environment.elastic_stack_available?).to be(true)
end
end
context 'when app is updated' do
let!(:application) { create(:clusters_applications_elastic_stack, :updated, cluster: cluster) }
it 'returns true' do
expect(environment.elastic_stack_available?).to be(true)
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment