Skip to content

Commit

Permalink
Test the same address is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Jan 29, 2021
1 parent 2b3e5c0 commit 16f8263
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/lib/miq_environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
example "local_ip_address" do
expect(described_class.local_ip_address).to be_in(Socket.ip_address_list.map(&:ip_address))
end

context "multiple private addresses" do
it "always returns the same address" do
allow(Socket).to receive(:ip_address_list).and_return([Addrinfo.ip("192.168.1.10"), Addrinfo.ip("10.1.2.3")])
expect(described_class.local_ip_address).to eq("10.1.2.3")
allow(Socket).to receive(:ip_address_list).and_return([Addrinfo.ip("10.1.2.3"), Addrinfo.ip("192.168.1.10")])
expect(described_class.local_ip_address).to eq("10.1.2.3")
end
end
end

context "Command" do
Expand Down

0 comments on commit 16f8263

Please sign in to comment.