summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--puppet/modules/site_config/manifests/dhclient.pp8
-rw-r--r--tests/white-box/webapp.rb21
2 files changed, 26 insertions, 3 deletions
diff --git a/puppet/modules/site_config/manifests/dhclient.pp b/puppet/modules/site_config/manifests/dhclient.pp
index dbe2ef1c..7755413b 100644
--- a/puppet/modules/site_config/manifests/dhclient.pp
+++ b/puppet/modules/site_config/manifests/dhclient.pp
@@ -22,11 +22,19 @@ class site_config::dhclient {
require => File['/usr/local/sbin/reload_dhclient'],
}
+ file { '/etc/dhcp/dhclient-enter-hooks.d':
+ ensure => directory,
+ mode => '0755',
+ owner => 'root',
+ group => 'root',
+ }
+
file { '/etc/dhcp/dhclient-enter-hooks.d/disable_resolvconf':
content => 'make_resolv_conf() { : ; } ; set_hostname() { : ; }',
mode => '0644',
owner => 'root',
group => 'root',
+ require => File['/etc/dhcp/dhclient-enter-hooks.d'],
notify => Exec['reload_dhclient'];
}
}
diff --git a/tests/white-box/webapp.rb b/tests/white-box/webapp.rb
index 1e78c8a5..9956eb35 100644
--- a/tests/white-box/webapp.rb
+++ b/tests/white-box/webapp.rb
@@ -99,18 +99,33 @@ class Webapp < LeapTest
# we try three times, and give up after that.
#
def assert_user_db_exists(user)
+ db_name = "user-#{user.id}"
+ repeatedly_try("/#{db_name}") do |body, response, error|
+ assert false, "Could not find user db `#{db_name}` for test user `#{user.username}`\nuuid=#{user.id}\nHTTP #{response.code} #{error} #{body}"
+ end
+ repeatedly_try("/#{db_name}/_design/docs") do |body, response, error|
+ assert false, "Could not find design docs for user db `#{db_name}` for test user `#{user.username}`\nuuid=#{user.id}\nHTTP #{response.code} #{error} #{body}"
+ end
+ end
+
+ #
+ # tries the URL repeatedly, giving up and yield the last response if
+ # no try returned a 200 http status code.
+ #
+ def repeatedly_try(url, &block)
last_body, last_response, last_error = nil
3.times do
sleep 0.2
- get(couchdb_url("/user-#{user.id}/_design/docs")) do |body, response, error|
+ get(couchdb_url(url)) do |body, response, error|
last_body, last_response, last_error = body, response, error
if response.code.to_i == 200
return
end
end
- sleep 0.5
+ sleep 1
end
- assert false, "Could not find user db for test user #{user.username}\nuuid=#{user.id}\nHTTP #{last_response.code} #{last_error} #{last_body}"
+ yield last_body, last_response, last_error
+ return
end
#