File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,20 @@ def remove_integration_test_apt_source
2727
2828After ( "@apt" ) do
2929remove_integration_test_apt_source
30+ purge_chef_integration_debs
31+ shell_out! "apt-get clean"
32+ end
33+
34+ Before ( '@dpkg' ) do
35+ purge_chef_integration_debs
3036end
3137
32- Before ( '@dpkg,@ apt' ) do
38+ Before ( '@apt' ) do
3339purge_chef_integration_debs
40+ shell_out! "apt-get clean"
3441end
3542
36- After ( '@dpkg,@apt ' ) do
43+ After ( '@dpkg' ) do
3744purge_chef_integration_debs
3845end
3946
@@ -64,6 +71,13 @@ def remove_integration_test_apt_source
6471
6572apt_server . start
6673end
74+
75+ Chef ::Log . debug "Waiting for apt server to start"
76+ until tcp_test_port ( "localhost" , 9000 ) do
77+ Chef ::Log . debug "."
78+ sleep 1
79+ end
80+ Chef ::Log . debug "done"
6781end
6882
6983Given "I have updated my apt cache" do
@@ -119,3 +133,13 @@ def dpkg_should_be_installed(pkg_name)
119133dpkg_should_be_installed ( package_name )
120134end
121135
136+ def tcp_test_port ( hostname , port )
137+ tcp_socket = TCPSocket . new ( hostname , port )
138+ true
139+ rescue Errno ::ETIMEDOUT
140+ false
141+ rescue Errno ::ECONNREFUSED
142+ false
143+ ensure
144+ tcp_socket && tcp_socket . close
145+ end
You can’t perform that action at this time.
0 commit comments