Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to capitalize when determining container status in topology #2337

Merged
merged 1 commit into from Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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