diff --git a/lib/workers/evm_server.rb b/lib/workers/evm_server.rb index 8a6303b53f9c..2d0b71ba49b6 100644 --- a/lib/workers/evm_server.rb +++ b/lib/workers/evm_server.rb @@ -92,7 +92,7 @@ def monitoring_server?(server) end def servers_from_db - MiqEnvironment::Command.is_podified? ? MiqServer.in_my_region.to_a : [MiqServer.my_server(true)] + MiqEnvironment::Command.is_podified? ? MiqServer.in_my_region.to_a : [MiqServer.my_server(true)].compact end def set_process_title diff --git a/spec/lib/workers/evm_server_spec.rb b/spec/lib/workers/evm_server_spec.rb index 3d46ad5418bf..c728bd3b6d40 100644 --- a/spec/lib/workers/evm_server_spec.rb +++ b/spec/lib/workers/evm_server_spec.rb @@ -10,6 +10,10 @@ expect(servers_to_monitor.first.id).to eq(server.id) end + it "doesn't give a nil server when there is no local server" do + expect(subject.servers_to_monitor).to be_empty + end + context "when podified" do let(:expected_ids) { MiqServer.pluck(:id) }