From 1f0720dfc25a16ea8b6067a80111074a71ff940f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 24 Dec 2011 21:40:08 -0800 Subject: [PATCH] Clean up the port forwarding test a bit --- test/acceptance/port_forward_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/acceptance/port_forward_test.rb b/test/acceptance/port_forward_test.rb index ad9ae7b50..55c3471e2 100644 --- a/test/acceptance/port_forward_test.rb +++ b/test/acceptance/port_forward_test.rb @@ -30,16 +30,17 @@ VFILE assert_execute("vagrant", "box", "add", "base", box_path("default")) assert_execute("vagrant", "up") - # Start up a web server in another thread by SSHing into the VM. thr = nil begin + # Start up a web server in another thread by SSHing into the VM. thr = Thread.new do assert_execute("vagrant", "ssh", "-c", "python -m SimpleHTTPServer #{guest_port}") end + # Verify that port forwarding works by making a simple HTTP request + # 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 - # Verify that port forwarding works by making a simple HTTP request - # to the port. We should get a 200 response. result = Net::HTTP.get_response(URI.parse("http://localhost:#{host_port}/")) result.code.should == "200" end