Please review pull request #120: (#11743) Delete contents of agent var directory in agent/master tests opened by (joshcooper)

Description:

Previously, the
helpful_error_message_when_hostname_not_match_server_certificate
test would correctly report that the server's hostname didn't match
its certificate, however, the test would attempt to use a cached
catalog. If one was present, for example, the 03_ValidateSignCert step
causes the agent to retrieve an empty catalog, then the agent would
apply the catalog and return exit code 0, causing the test to fail.

This commit deletes the contents of the agents' vardir, but not the
vardir itself. This change will only affect tests that use the
with_master_running_on method and that define the puppetvardir
property for the host, which PE hosts do not.

  • Opened: Sat Jan 21 21:19:56 UTC 2012
  • Based on: puppetlabs:master (e1bb15fc5120cb6c172bb5736baf5fbd785b8539)
  • Requested merge: joshcooper:ticket/master/11743-delete-vardir-contents (2d37c6f0e2a08c65a2853c493428b242c4b09d67)

Diff follows:

diff --git a/lib/test_case.rb b/lib/test_case.rb
index f66b1fd..42d4d32 100644
--- a/lib/test_case.rb
+++ b/lib/test_case.rb
@@ -249,6 +249,12 @@ def run_cron_on(host, action, user, entry="", &block)
 
   def with_master_running_on(host, arg='--daemonize', &block)
     on hosts, host_command('rm -rf #{host["puppetpath"]}/ssl')
+    agents.each do |agent|
+      if vardir = agent['puppetvardir']
+        on agent, "rm -rf #{vardir}/*"
+      end
+    end
+
     on host, puppet_master('--configprint pidfile')
     pidfile = stdout.chomp
     on host, puppet_master(arg)
diff --git a/lib/test_case/host.rb b/lib/test_case/host.rb
index af6863d..d625722 100644
--- a/lib/test_case/host.rb
+++ b/lib/test_case/host.rb
@@ -120,6 +120,7 @@ class UnixHost < Host
 
     DEFAULTS = {
       'puppetpath'   => '/etc/puppet',
+      'puppetvardir' => '/var/lib/puppet',
       'puppetbin'    => '/usr/bin/puppet',
       'puppetbindir' => '/usr/bin'
     }
@@ -133,8 +134,9 @@ def initialize(name, overrides, defaults)
 
   class WindowsHost < Host
     DEFAULTS = {
-      'user'       => 'Administrator',
-      'puppetpath' => '"`cygpath -F 35`/PuppetLabs/puppet/etc"'
+      'user'         => 'Administrator',
+      'puppetpath'   => '"`cygpath -F 35`/PuppetLabs/puppet/etc"',
+      'puppetvardir' => '"`cygpath -F 35`/PuppetLabs/puppet/var"'
     }
 
     def initialize(name, overrides, defaults)

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to