summaryrefslogtreecommitdiff
path: root/features/steps
diff options
context:
space:
mode:
authorsdelano <stephen@opscode.com>2010-11-12 11:58:42 -0800
committersdelano <stephen@opscode.com>2010-11-12 11:58:42 -0800
commite74a18c5c01368ea5c174c55457de3466d021085 (patch)
treecdad59f6da3abe324f7c8600203aa2257c845a66 /features/steps
parentc1d74b9d82ee01a8d3a6428646652ad84ab331b1 (diff)
downloadchef-e74a18c5c01368ea5c174c55457de3466d021085.tar.gz
[CHEF-1864] wait for apt server to come up
Diffstat (limited to 'features/steps')
-rw-r--r--features/steps/packages.rb29
1 files changed, 27 insertions, 2 deletions
diff --git a/features/steps/packages.rb b/features/steps/packages.rb
index 7eb2f3d21b..d0403dd143 100644
--- a/features/steps/packages.rb
+++ b/features/steps/packages.rb
@@ -27,13 +27,20 @@ end
After("@apt") do
remove_integration_test_apt_source
+ purge_chef_integration_debs
+ shell_out! "apt-get clean"
+end
+
+Before('@dpkg') do
+ purge_chef_integration_debs
end
-Before('@dpkg,@apt') do
+Before('@apt') do
purge_chef_integration_debs
+ shell_out! "apt-get clean"
end
-After('@dpkg,@apt') do
+After('@dpkg') do
purge_chef_integration_debs
end
@@ -64,6 +71,13 @@ Given "the apt server is running" do
apt_server.start
end
+
+ Chef::Log.debug "Waiting for apt server to start"
+ until tcp_test_port("localhost", 9000) do
+ Chef::Log.debug "."
+ sleep 1
+ end
+ Chef::Log.debug "done"
end
Given "I have updated my apt cache" do
@@ -117,3 +131,14 @@ end
Then "the dpkg package '$package_name' should be installed" do |package_name|
dpkg_should_be_installed(package_name)
end
+
+def tcp_test_port(hostname, port)
+ tcp_socket = TCPSocket.new(hostname, port)
+ true
+rescue Errno::ETIMEDOUT
+ false
+rescue Errno::ECONNREFUSED
+ false
+ensure
+ tcp_socket && tcp_socket.close
+end \ No newline at end of file