Skip to content

Commit

Permalink
Don't return [nil] when we don't have a local server yet
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed Jan 21, 2020
1 parent 1362205 commit 90fef18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/workers/evm_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/workers/evm_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down

0 comments on commit 90fef18

Please sign in to comment.