Skip to content

Commit

Permalink
Try to capitalize when determining container status in topology
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Oct 10, 2017
1 parent 94080e1 commit 1f4b61e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/services/container_topology_service.rb
Expand Up @@ -65,7 +65,7 @@ def entity_status(entity)
elsif entity.kind_of?(ContainerGroup)
status = entity.phase
elsif entity.kind_of?(Container)
status = entity.state.capitalize
status = entity.state.try(:capitalize)
elsif entity.kind_of?(ContainerReplicator)
status = entity.current_replicas == entity.replicas ? 'OK' : 'Warning'
elsif entity.kind_of?(ManageIQ::Providers::ContainerManager)
Expand Down
14 changes: 14 additions & 0 deletions spec/services/container_topology_service_spec.rb
Expand Up @@ -188,4 +188,18 @@
)
end
end

describe '#entity_status' do
context 'entity is a container' do
let(:entity) { FactoryGirl.create(:container) }

context 'state is not defined' do
before { allow(entity).to receive(:state).and_return(nil) }

it 'returns with nil' do
expect(container_topology_service.entity_status(entity)).to be_nil
end
end
end
end
end

0 comments on commit 1f4b61e

Please sign in to comment.