summaryrefslogtreecommitdiffstats
path: root/acceptance
diff options
context:
space:
mode:
authorDominic Maraglia <dominic@puppetlabs.com>2011-07-14 15:01:13 -0700
committerDominic Maraglia <dominic@puppetlabs.com>2011-07-14 15:01:13 -0700
commita109c908f6d46d0b3a8bcd203b661d150eabb1ba (patch)
treeb29c95e99e81aa45fadfecc6cd6686fb2a6ac148 /acceptance
parentb8e67ba44f7605260bc3141250d746ae748df2a2 (diff)
downloadpuppet-a109c908f6d46d0b3a8bcd203b661d150eabb1ba.tar.gz
puppet-a109c908f6d46d0b3a8bcd203b661d150eabb1ba.tar.xz
puppet-a109c908f6d46d0b3a8bcd203b661d150eabb1ba.zip
(maint) Cleanup and strengthen acceptance tests
Converted plain regex checks to use Test::Unit::Accertions. Adding more verbose output in the case of failure to speeed debugging.
Diffstat (limited to 'acceptance')
-rw-r--r--acceptance/tests/jeff_append_to_array.rb9
-rw-r--r--acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb9
-rw-r--r--acceptance/tests/puppet_apply_basics.rb8
-rw-r--r--acceptance/tests/puppet_apply_should_show_a_notice.rb8
-rw-r--r--acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb8
-rw-r--r--acceptance/tests/ticket_4059_ralsh_can_change_settings.rb7
-rw-r--r--acceptance/tests/ticket_4110_puppet_apply_should_not_create_a_user_that_already_exists.rb6
-rw-r--r--acceptance/tests/ticket_4233_resource_with_a_newline.rb7
-rw-r--r--acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb6
-rw-r--r--acceptance/tests/ticket_4287_undefined_method_evaluate_match_when_function_call_used_in_an_if_statement.rb7
-rw-r--r--acceptance/tests/ticket_4289_facter_should_recognize_OEL_operatingsystemrelease.rb2
-rw-r--r--acceptance/tests/ticket_4293_define_and_use_a_define_within_a_class.rb7
-rw-r--r--acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb6
-rw-r--r--acceptance/tests/ticket_6541_invalid_filebucket_files.rb21
-rw-r--r--acceptance/tests/ticket_6734_6256_5530_5503.rb2
15 files changed, 68 insertions, 45 deletions
diff --git a/acceptance/tests/jeff_append_to_array.rb b/acceptance/tests/jeff_append_to_array.rb
index 415d59fe8..20f43665e 100644
--- a/acceptance/tests/jeff_append_to_array.rb
+++ b/acceptance/tests/jeff_append_to_array.rb
@@ -12,8 +12,9 @@ manifest = %q{
include parent::child
}
-apply_manifest_on(agents, manifest) do
- stdout =~ /notice: parent array element/ or fail_test("parent missing")
- stdout =~ /notice: child array element/ or fail_test("child missing")
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_match(/notice: parent array element/, stdout, "#{host}: parent missing")
+ assert_match(/notice: child array element/, stdout, "#{host}: child missing")
+ end
end
-
diff --git a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb
index abb06fbaf..44338520a 100644
--- a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb
+++ b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb
@@ -6,10 +6,11 @@ manifest = "file{'#{file}': content => 'test'}"
step "clean up #{file} for testing"
on agents, "rm -f #{file}"
-step "run the manifest and verify MD5 was printed"
-apply_manifest_on(agents, manifest) do
- fail_test "didn't find the content MD5 on output" unless
- stdout.include? "defined content as '{md5}098f6bcd4621d373cade4e832627b4f6'"
+step "Run the manifest and verify MD5 was printed"
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_match(/defined content as '{md5}098f6bcd4621d373cade4e832627b4f6'/, stdout, "#{host}: didn't find the content MD5 on output")
+ end
end
step "clean up #{file} after testing"
diff --git a/acceptance/tests/puppet_apply_basics.rb b/acceptance/tests/puppet_apply_basics.rb
index bbbdefc15..23c57d84d 100644
--- a/acceptance/tests/puppet_apply_basics.rb
+++ b/acceptance/tests/puppet_apply_basics.rb
@@ -5,11 +5,13 @@
test_name "Trivial puppet tests"
step "check that puppet apply displays notices"
-apply_manifest_on(agents, "notice 'Hello World'") do
- stdout =~ /notice:.*Hello World/ or fail_test("missing notice!")
+agents.each do |host|
+ apply_manifest_on(host, "notice 'Hello World'") do
+ assert_match(/notice:.*Hello World/, stdout, "#{host}: missing notice!")
+ end
end
step "verify help displays something for puppet master"
on master, puppet_master("--help") do
- stdout =~ /puppet master/ or fail_test("improper help output")
+ assert_match(/puppet master/, stdout, "improper help output")
end
diff --git a/acceptance/tests/puppet_apply_should_show_a_notice.rb b/acceptance/tests/puppet_apply_should_show_a_notice.rb
index af6f41ca7..757d29bbf 100644
--- a/acceptance/tests/puppet_apply_should_show_a_notice.rb
+++ b/acceptance/tests/puppet_apply_should_show_a_notice.rb
@@ -1,5 +1,7 @@
test_name "puppet apply should show a notice"
-apply_manifest_on(agents, "notice 'Hello World'") do
- fail_test "the notice didn't show" unless
- stdout =~ /notice: .*: Hello World/
+
+agents.each do |host|
+ apply_manifest_on(host, "notice 'Hello World'") do
+ assert_match(/notice: .*: Hello World/, stdout, "#{host}: the notice didn't show")
+ end
end
diff --git a/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb b/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
index 436ce29fe..24dd7256b 100644
--- a/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
+++ b/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
@@ -2,6 +2,8 @@ test_name "#3172: puppet kick with hostnames on the command line"
step "verify that we trigger our host"
target = 'working.example.org'
-on(agents, puppet_kick(target), :acceptable_exit_codes => [3]) {
- fail_test "didn't trigger #{target}" unless stdout.include? "Triggering #{target}"
-}
+agents.each do |host|
+ on(host, puppet_kick(target), :acceptable_exit_codes => [3]) {
+ assert_match(/Triggering #{target}/, stdout, "didn't trigger #{target} on #{host}" )
+ }
+end
diff --git a/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb b/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb
index c97bbdbe6..83f5899f2 100644
--- a/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb
+++ b/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb
@@ -11,9 +11,10 @@ on(agents, puppet_resource(content)) do
stdout.index('Host[example.com]/ensure: created') or
fail_test("missing notice about host record creation")
end
-on(agents, "cat #{target}") do
- stdout =~ /^127\.0\.0\.1\s+example\.com/ or
- fail_test("missing host record in #{target}")
+agents.each do |host|
+ on(host, "cat #{target}") do
+ assert_match(/^127\.0\.0\.1\s+example\.com/, stdout, "missing host record in #{target} on #{host}")
+ end
end
step "cleanup at the end of the test"
diff --git a/acceptance/tests/ticket_4110_puppet_apply_should_not_create_a_user_that_already_exists.rb b/acceptance/tests/ticket_4110_puppet_apply_should_not_create_a_user_that_already_exists.rb
index 9704250d9..147857362 100644
--- a/acceptance/tests/ticket_4110_puppet_apply_should_not_create_a_user_that_already_exists.rb
+++ b/acceptance/tests/ticket_4110_puppet_apply_should_not_create_a_user_that_already_exists.rb
@@ -1,5 +1,7 @@
test_name "#4110: puppet apply should not create a user that already exists"
-apply_manifest_on(agents, "user { 'root': ensure => 'present' }") do
- fail_test("we tried to create root on this host") if stdout =~ /created/
+agents.each do |host|
+ apply_manifest_on(host, "user { 'root': ensure => 'present' }") do
+ assert_no_match(/created/, stdout, "we tried to create root on #{host}" )
+ end
end
diff --git a/acceptance/tests/ticket_4233_resource_with_a_newline.rb b/acceptance/tests/ticket_4233_resource_with_a_newline.rb
index 7bb7dc3c3..11924b550 100644
--- a/acceptance/tests/ticket_4233_resource_with_a_newline.rb
+++ b/acceptance/tests/ticket_4233_resource_with_a_newline.rb
@@ -8,6 +8,9 @@ test_name "#4233: resource with a newline"
# and 2.6.0 final to not return an error line.
# Look for the line in the output and fail the test
# if we find it.
-apply_manifest_on(agents, 'exec { \'/bin/echo -e "\nHello World\n"\': }') do
- stdout =~ /err:/ and fail_test("error report in output, sorry")
+
+agents.each do |host|
+ apply_manifest_on(host, 'exec { \'/bin/echo -e "\nHello World\n"\': }') do
+ assert_no_match(/err:/, stdout, "error report in output on #{host}")
+ end
end
diff --git a/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb b/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb
index d2297fbc4..c1cdb0b9d 100644
--- a/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb
+++ b/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb
@@ -12,6 +12,8 @@ manifest = %q{
}
}
-apply_manifest_on(agents, manifest) do
- fail_test "found the bug report output" if stdout =~ /Cannot alias/
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_no_match(/Cannot alias/, stdout, "#{host}: found the bug report output")
+ end
end
diff --git a/acceptance/tests/ticket_4287_undefined_method_evaluate_match_when_function_call_used_in_an_if_statement.rb b/acceptance/tests/ticket_4287_undefined_method_evaluate_match_when_function_call_used_in_an_if_statement.rb
index e9a17df36..f5a1c1685 100644
--- a/acceptance/tests/ticket_4287_undefined_method_evaluate_match_when_function_call_used_in_an_if_statement.rb
+++ b/acceptance/tests/ticket_4287_undefined_method_evaluate_match_when_function_call_used_in_an_if_statement.rb
@@ -7,7 +7,8 @@ manifest = %q{
}
}
-apply_manifest_on(agents, manifest) do
- fail_test "didn't get the expected notice" unless
- stdout.include? 'notice: No issue here...'
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_match(/notice: No issue here.../, stdout, "didn't get the expected notice on #{host}")
+ end
end
diff --git a/acceptance/tests/ticket_4289_facter_should_recognize_OEL_operatingsystemrelease.rb b/acceptance/tests/ticket_4289_facter_should_recognize_OEL_operatingsystemrelease.rb
index 653fcb274..cacb7db65 100644
--- a/acceptance/tests/ticket_4289_facter_should_recognize_OEL_operatingsystemrelease.rb
+++ b/acceptance/tests/ticket_4289_facter_should_recognize_OEL_operatingsystemrelease.rb
@@ -16,6 +16,6 @@ agents.each do |host|
if stdout =~ /oel/i then
step "test operatingsystemrelease fact on OEL host #{host}"
on host, facter("operatingsystemrelease")
- stdout =~ /^\d\.\d$/ or fail_test "operatingsystemrelease not as expected"
+ assert_match(/^\d\.\d$/, stdout, "operatingsystemrelease not as expected on #{host}")
end
end
diff --git a/acceptance/tests/ticket_4293_define_and_use_a_define_within_a_class.rb b/acceptance/tests/ticket_4293_define_and_use_a_define_within_a_class.rb
index 830da99b4..aa42fd401 100644
--- a/acceptance/tests/ticket_4293_define_and_use_a_define_within_a_class.rb
+++ b/acceptance/tests/ticket_4293_define_and_use_a_define_within_a_class.rb
@@ -16,7 +16,8 @@ class foo {
include foo
PP
-apply_manifest_on(agents, manifest) do
- stdout =~ /notice.*?Foo::Do_notify.*?a_message_for_you/ or
- fail_test("the notification didn't show up in stdout")
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_match(/notice.*?Foo::Do_notify.*?a_message_for_you/, stdout, "the notification didn't show up in stdout on #{host}")
+ end
end
diff --git a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
index 3b0e21512..e57b268ef 100644
--- a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
+++ b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
@@ -24,7 +24,9 @@ with_master_running_on(master, "--manifest #{manifest_file} --certdnsnames=\"pup
sleep 3
step "Agent: puppet agent --test"
- on agents, puppet_agent("--test"), :acceptable_exit_codes => [2] do
- fail_test "Site.pp not detect at Master?" unless stdout.include? 'ticket_5477_notify'
+ agents.each do |host|
+ on(host, puppet_agent("--test"), :acceptable_exit_codes => [2]) do
+ assert_match(/ticket_5477_notify/, stdout, "#{host}: Site.pp not detected on Puppet Master")
+ end
end
end
diff --git a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb
index 25bcff452..33b985b67 100644
--- a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb
+++ b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb
@@ -4,23 +4,26 @@ apply_manifest_on(agents, manifest)
test_name "verify invalid hashes should not change the file"
manifest = "file { '/tmp/6541': content => '{md5}notahash' }"
-apply_manifest_on(agents, manifest) do
- fail_test "shouldn't have overwrote the file" if
- stdout =~ /content changed/
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file")
+ end
end
test_name "verify valid but unbucketed hashes should not change the file"
manifest = "file { '/tmp/6541': content => '{md5}13ad7345d56b566a4408ffdcd877bc78' }"
-apply_manifest_on(agents, manifest) do
- fail_test "shouldn't have overwrote the file" if
- stdout =~ /content changed/
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file")
+ end
end
on(agents, puppet_filebucket("backup -l /dev/null") )
test_name "verify that an empty file can be retrieved from the filebucket"
manifest = "file { '/tmp/6541': content => '{md5}d41d8cd98f00b204e9800998ecf8427e' }"
-apply_manifest_on(agents, manifest) do
- fail_test "shouldn't have overwrote the file" unless
- stdout =~ /content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/
+agents.each do |host|
+ apply_manifest_on(host, manifest) do
+ assert_match(/content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/, stdout, "#{host}: shouldn't have overwrote the file")
+ end
end
diff --git a/acceptance/tests/ticket_6734_6256_5530_5503.rb b/acceptance/tests/ticket_6734_6256_5530_5503.rb
index 8f0155efb..a59ac13ab 100644
--- a/acceptance/tests/ticket_6734_6256_5530_5503.rb
+++ b/acceptance/tests/ticket_6734_6256_5530_5503.rb
@@ -9,6 +9,6 @@ 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}'" do
- fail_test "puppet/rrd does not exist/wrong permission" unless stdout.include? 'puppet puppet'
+ assert_match(/puppet puppet/, stdout, "puppet/rrd does not exist/wrong permissions")
end
end