-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guests/linux: Always order discovered network interfaces
- Loading branch information
1 parent
4b1d45b
commit a4a8ab9
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
test/unit/plugins/guests/linux/cap/network_interfaces_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require_relative "../../../../base" | ||
|
||
describe "VagrantPlugins::GuestLinux::Cap::NetworkInterfaces" do | ||
let(:caps) do | ||
VagrantPlugins::GuestLinux::Plugin | ||
.components | ||
.guest_capabilities[:linux] | ||
end | ||
|
||
let(:machine) { double("machine") } | ||
let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) } | ||
|
||
before do | ||
allow(machine).to receive(:communicate).and_return(comm) | ||
end | ||
|
||
after do | ||
comm.verify_expectations! | ||
end | ||
|
||
describe ".network_interfaces" do | ||
let(:cap){ caps.get(:network_interfaces) } | ||
|
||
it "sorts discovered interfaces" do | ||
expect(comm).to receive(:sudo).and_yield(:stdout, "eth1\neth2\neth0") | ||
result = cap.network_interfaces(machine) | ||
expect(result).to eq(["eth0", "eth1", "eth2"]) | ||
end | ||
end | ||
end |