summaryrefslogtreecommitdiffstats
path: root/acceptance
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-06-08 17:18:22 -0700
committerNick Lewis <nick@puppetlabs.com>2011-06-08 18:01:31 -0700
commit376e0f04af01810d00eede4de52744bb8c8e1681 (patch)
tree4723aa8e5667a664dffa2f3cd10832d9b511b604 /acceptance
parent4922409a2bdf3ad6a094762c9e2e60371ed16a1b (diff)
parentb1a506c7dec849415073e1bf4b3c92f3c898d6d9 (diff)
downloadpuppet-376e0f04af01810d00eede4de52744bb8c8e1681.tar.gz
puppet-376e0f04af01810d00eede4de52744bb8c8e1681.tar.xz
puppet-376e0f04af01810d00eede4de52744bb8c8e1681.zip
Merge branch '2.6.x' into 2.7.x
Conflicts: acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb lib/puppet/application/apply.rb lib/puppet/configurer.rb lib/puppet/configurer/fact_handler.rb spec/unit/application/apply_spec.rb spec/unit/configurer/fact_handler_spec.rb spec/unit/configurer_spec.rb
Diffstat (limited to 'acceptance')
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb46
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_fact_for_apply.rb30
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_for_agent.rb29
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_for_apply.rb17
-rw-r--r--acceptance/tests/allow_symlinks_as_config_directories.rb27
-rw-r--r--acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb2
-rw-r--r--acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb6
-rw-r--r--acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb48
-rw-r--r--acceptance/tests/ticket_6734_6256_5530_5503.rb14
-rw-r--r--acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb2
10 files changed, 176 insertions, 45 deletions
diff --git a/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb
new file mode 100644
index 000000000..2e89d765f
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb
@@ -0,0 +1,46 @@
+test_name "node_name_fact should be used to determine the node name for puppet agent"
+
+success_message = "node_name_fact setting was correctly used to determine the node name"
+
+node_names = []
+
+on agents, facter('kernel') do
+ node_names << stdout.chomp
+end
+
+node_names.uniq!
+
+authfile = "/tmp/auth.conf-2128-#{$$}"
+authconf = node_names.map do |node_name|
+ %Q[
+path /catalog/#{node_name}
+auth yes
+allow *
+]
+end.join("\n")
+
+manifest_file = "/tmp/node_name_value-test-#{$$}.pp"
+manifest = %Q[
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+]
+manifest << node_names.map do |node_name|
+ %Q[
+ node "#{node_name}" {
+ exec { "echo #{success_message}": }
+ }
+ ]
+end.join("\n")
+
+create_remote_file master, authfile, authconf
+create_remote_file master, manifest_file, manifest
+
+on master, "chmod 644 #{authfile} #{manifest_file}"
+
+with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --autosign true") do
+ run_agent_on(agents, "--no-daemonize --verbose --onetime --node_name_fact kernel --server #{master}") do
+ assert_match(success_message, stdout)
+ end
+end
diff --git a/acceptance/tests/allow_arbitrary_node_name_fact_for_apply.rb b/acceptance/tests/allow_arbitrary_node_name_fact_for_apply.rb
new file mode 100644
index 000000000..d7cf2dcac
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_fact_for_apply.rb
@@ -0,0 +1,30 @@
+test_name "node_name_fact should be used to determine the node name for puppet apply"
+
+success_message = "node_name_fact setting was correctly used to determine the node name"
+
+node_names = []
+
+on agents, facter('kernel') do
+ node_names << stdout.chomp
+end
+
+node_names.uniq!
+
+manifest = %Q[
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+]
+
+node_names.each do |node_name|
+ manifest << %Q[
+ node "#{node_name}" {
+ exec { "echo #{success_message}": }
+ }
+ ]
+end
+
+on agents, puppet_apply("--verbose --node_name_fact kernel"), :stdin => manifest do
+ assert_match(success_message, stdout)
+end
diff --git a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb
new file mode 100644
index 000000000..f5e027660
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb
@@ -0,0 +1,29 @@
+test_name "node_name_value should be used as the node name for puppet agent"
+
+success_message = "node_name_value setting was correctly used as the node name"
+
+authfile = "/tmp/auth.conf-2128-#{$$}"
+create_remote_file master, authfile, <<AUTHCONF
+path /catalog/specified_node_name
+auth yes
+allow *
+AUTHCONF
+
+manifest_file = "/tmp/node_name_value-test-#{$$}.pp"
+create_remote_file master, manifest_file, <<MANIFEST
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+ node specified_node_name {
+ exec { "echo #{success_message}": }
+ }
+MANIFEST
+
+on master, "chmod 644 #{authfile} #{manifest_file}"
+
+with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --autosign true") do
+ run_agent_on(agents, "--no-daemonize --verbose --onetime --node_name_value specified_node_name --server #{master}") do
+ assert_match(success_message, stdout)
+ end
+end
diff --git a/acceptance/tests/allow_arbitrary_node_name_for_apply.rb b/acceptance/tests/allow_arbitrary_node_name_for_apply.rb
new file mode 100644
index 000000000..4daa8a65b
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_for_apply.rb
@@ -0,0 +1,17 @@
+test_name "node_name_value should be used as the node name for puppet apply"
+
+success_message = "node_name_value setting was correctly used as the node name"
+
+manifest = %Q[
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+ node a_different_node_name {
+ exec { "echo #{success_message}": }
+ }
+]
+
+on agents, puppet_apply("--verbose --node_name_value a_different_node_name"), :stdin => manifest do
+ assert_match(success_message, stdout)
+end
diff --git a/acceptance/tests/allow_symlinks_as_config_directories.rb b/acceptance/tests/allow_symlinks_as_config_directories.rb
new file mode 100644
index 000000000..66c6ccca0
--- /dev/null
+++ b/acceptance/tests/allow_symlinks_as_config_directories.rb
@@ -0,0 +1,27 @@
+test_name "Should allow symlinks to directories as configuration directories"
+
+step "Create the test confdir with a link to it"
+confdir = "/tmp/puppet_conf-directory-#{$$}"
+conflink = "/tmp/puppet_conf-symlink-#{$$}"
+
+on agents, "rm -rf #{conflink} #{confdir}"
+
+on agents, "mkdir #{confdir}"
+on agents, "ln -s #{confdir} #{conflink}"
+
+create_remote_file agents, "#{confdir}/puppet.conf", <<CONFFILE
+[main]
+certname = "awesome_certname"
+CONFFILE
+
+manifest = 'notify{"My certname is $clientcert": }'
+
+step "Run Puppet and ensure it used the conf file in the confdir"
+on agents, puppet_apply("--confdir #{conflink}"), :stdin => manifest do
+ assert_match("My certname is awesome_certname", stdout)
+end
+
+step "Check that the symlink and confdir are unchanged"
+on agents, "[ -L #{conflink} ]"
+on agents, "[ -d #{confdir} ]"
+on agents, "[ $(readlink #{conflink}) = #{confdir} ]"
diff --git a/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb b/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb
index ba02227ea..58f98d2a0 100644
--- a/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb
+++ b/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb
@@ -46,5 +46,5 @@ step "Verify the certs have changed"
# where certs might be signed with long names.
old_certs.each_key { |key|
next if key.include? master # skip the masters cert, only care about agents
- fail_test("#{key} does not have a new signed certificate") if old_certs[key] == new_certs[key]
+ assert_not_equal(old_certs[key], new_certs[key], "Expected #{key} to have a changed key")
}
diff --git a/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb b/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb
index 4b5bc377b..22a5b4b92 100644
--- a/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb
+++ b/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb
@@ -3,7 +3,7 @@ test_name "#3961: puppet ca should produce certs spec"
scratch = "/tmp/puppet-ssl-3961"
target = "working3961.example.org"
-options = { :confdir => scratch, :vardir => scratch, :ssldir => scratch }
+options = { :confdir => scratch, :vardir => scratch }
expect = ['notice: Signed certificate request for ca',
'notice: Rebuilding inventory file',
@@ -23,7 +23,7 @@ on(agents,puppet_cert('--trace', '--generate', target, options)) do
end
step "verify the certificate for #{target} exists"
-on agents, "test -f #{scratch}/certs/#{target}.pem"
+on agents, "test -f #{scratch}/ssl/certs/#{target}.pem"
step "verify the private key for #{target} exists"
-on agents, "grep -q 'BEGIN RSA PRIVATE KEY' #{scratch}/private_keys/#{target}.pem"
+on agents, "grep -q 'BEGIN RSA PRIVATE KEY' #{scratch}/ssl/private_keys/#{target}.pem"
diff --git a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
index 792e88b46..d8723b2ec 100644
--- a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
+++ b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
@@ -6,41 +6,25 @@
test_name "Ticket 5477, Puppet Master does not detect newly created site.pp file"
-# Kill running Puppet Master
-step "Master: kill running Puppet Master"
-on master, "ps -U puppet | awk '/puppet/ { print \$1 }' | xargs kill"
+manifest_file = "/tmp/missing_site-5477-#{$$}.pp"
-# Run tests against Master first
-step "Master: mv site.pp file to /tmp, if existing"
-on master, "if [ -e /etc/puppet/manifests/site.pp ] ; then mv /etc/puppet/manifests/site.pp /tmp/site.pp-5477 ; fi"
+on master, "rm -f #{manifest_file}"
-# Start Puppet Master
-#step "Master: Run Puppet Master in verbose mode"
-#on master, puppet_master("--verbose")
-step "Master: Start Puppet Master"
-on master, puppet_master("--certdnsnames=\"puppet:$(hostname -s):$(hostname -f)\" --verbose")
+with_master_running_on(master, "--manifest #{manifest_file} --certdnsnames=\"puppet:$(hostname -s):$(hostname -f)\" --verbose --filetimeout 1") do
+ # Run test on Agents
+ step "Agent: agent --test"
+ on agents, puppet_agent("--test --server #{master}")
-# Allow puppet server to start accepting conections
-sleep 10
+ # Create a new site.pp
+ step "Master: create basic site.pp file"
+ create_remote_file master, manifest_file, "notify{ticket_5477_notify:}"
-# Run test on Agents
-step "Agent: agent --test"
-agents.each { |agent|
- on agent, puppet_agent("--test")
-}
-
-# Create a new site.pp
-step "Master: create basic site.pp file"
-on master, "echo 'notify{ticket_5477_notify:}' > /etc/puppet/manifests/site.pp"
-
-sleep 20
+ on master, "chmod 644 #{manifest_file}"
-step "Agent: puppet agent --test"
-agents.each { |agent|
- on agent, "puppet agent -t", :acceptable_exit_codes => [2]
- fail_test "Site.pp not detect at Master?" unless
- stdout.include? 'ticket_5477_notify'
-}
+ sleep 3
-step "Clean-up site.pp"
-on master, "rm /etc/puppet/manifests/site.pp"
+ step "Agent: puppet agent --test"
+ on agents, puppet_agent("--test --server #{master}"), :acceptable_exit_codes => [2] do
+ fail_test "Site.pp not detect at Master?" unless stdout.include? 'ticket_5477_notify'
+ end
+end
diff --git a/acceptance/tests/ticket_6734_6256_5530_5503.rb b/acceptance/tests/ticket_6734_6256_5530_5503.rb
index fe8866901..8f0155efb 100644
--- a/acceptance/tests/ticket_6734_6256_5530_5503.rb
+++ b/acceptance/tests/ticket_6734_6256_5530_5503.rb
@@ -5,12 +5,10 @@
test_name "Tickets 6734 6256 5530 5503i Puppet Master fails to start"
# Kill running Puppet Master
-step "Check for running Puppet Master"
-on master, "ps -ef | grep puppet"
- fail_test "Puppet Master not running" unless
- stdout.include? 'master'
+with_master_running_on(master) do
-step "Check permissions on puppet/rrd/"
-on master, "ls -l /var/lib/puppet | grep rrd | awk '{print $3\" \"$4}'"
- fail_test "puppet/rrd does not exist/wrong permission" unless
- stdout.include? 'puppet puppet'
+ step "Check permissions on puppet/rrd/"
+ on master, "ls -l /var/lib/puppet | grep rrd | awk '{print $3\" \"$4}'" do
+ fail_test "puppet/rrd does not exist/wrong permission" unless stdout.include? 'puppet puppet'
+ end
+end
diff --git a/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb b/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb
index 07b427306..f8f03f287 100644
--- a/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb
+++ b/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb
@@ -42,7 +42,7 @@ Log.notify "Slept for #{elapsed} seconds waiting for Puppet Master to become rea
# Run test on Agents
step "Agent: agent --test"
-on agents, puppet_agent("--test")
+on agents, puppet_agent("--test --server #{master}")
step "Fetch agent facts from Puppet Master"
agents.each do |host|