Clean up the port forwarding test a bit
This commit is contained in:
parent
f7275f5113
commit
1f0720dfc2
|
@ -30,16 +30,17 @@ VFILE
|
||||||
assert_execute("vagrant", "box", "add", "base", box_path("default"))
|
assert_execute("vagrant", "box", "add", "base", box_path("default"))
|
||||||
assert_execute("vagrant", "up")
|
assert_execute("vagrant", "up")
|
||||||
|
|
||||||
# Start up a web server in another thread by SSHing into the VM.
|
|
||||||
thr = nil
|
thr = nil
|
||||||
begin
|
begin
|
||||||
|
# Start up a web server in another thread by SSHing into the VM.
|
||||||
thr = Thread.new do
|
thr = Thread.new do
|
||||||
assert_execute("vagrant", "ssh", "-c", "python -m SimpleHTTPServer #{guest_port}")
|
assert_execute("vagrant", "ssh", "-c", "python -m SimpleHTTPServer #{guest_port}")
|
||||||
end
|
end
|
||||||
|
|
||||||
retryable(:tries => 5, :sleep => 2) do
|
|
||||||
# Verify that port forwarding works by making a simple HTTP request
|
# Verify that port forwarding works by making a simple HTTP request
|
||||||
# to the port. We should get a 200 response.
|
# to the port. We should get a 200 response. We retry this a few times
|
||||||
|
# as we wait for the HTTP server to come online.
|
||||||
|
retryable(:tries => 5, :sleep => 2) do
|
||||||
result = Net::HTTP.get_response(URI.parse("http://localhost:#{host_port}/"))
|
result = Net::HTTP.get_response(URI.parse("http://localhost:#{host_port}/"))
|
||||||
result.code.should == "200"
|
result.code.should == "200"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue