guests/linux: Add tests for port

This commit is contained in:
Seth Vargo 2016-06-05 15:11:53 -04:00
parent 3e2374ad38
commit 6b1749a6fb
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
require_relative "../../../../base"
describe "VagrantPlugins::GuestLinux::Cap::Port" 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 ".port_open_check" do
let(:cap) { caps.get(:port_open_check) }
it "checks if the port is open" do
port = 8080
comm.expect_command("nc -z -w2 127.0.0.1 #{port}")
cap.port_open_check(machine, port)
end
end
end