summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominic Maraglia <dominic@puppetlabs.com>2011-06-27 13:58:44 -0700
committerDominic Maraglia <dominic@puppetlabs.com>2011-06-27 13:58:44 -0700
commit3e3fc693c2a96f6cf56e670f6d5ae5cd70f6a523 (patch)
tree86b44b9cee04b3bd16d482fe8f897f9f5870665c
parentc9746538f486233f854382c4a0f6e46126ae339a (diff)
downloadpuppet-3e3fc693c2a96f6cf56e670f6d5ae5cd70f6a523.tar.gz
puppet-3e3fc693c2a96f6cf56e670f6d5ae5cd70f6a523.tar.xz
puppet-3e3fc693c2a96f6cf56e670f6d5ae5cd70f6a523.zip
(#7956) Port resource acceptance tests
Many of the Puppet resource acceptance tests were RHEL/Centos specifc. These tests were ported under the enterptise-dist repo; move the tests into 2.6.x for merging.
-rw-r--r--acceptance/tests/resource/cron/should_create_cron.rb6
-rwxr-xr-xacceptance/tests/resource/cron/should_match_existing.rb13
-rwxr-xr-xacceptance/tests/resource/cron/should_remove_cron.rb12
-rwxr-xr-xacceptance/tests/resource/cron/should_remove_matching.rb8
-rwxr-xr-xacceptance/tests/resource/cron/should_update_existing.rb14
-rw-r--r--acceptance/tests/resource/file/content_attribute.rb35
-rwxr-xr-xacceptance/tests/resource/file/should_create_directory.rb4
-rwxr-xr-xacceptance/tests/resource/file/should_create_empty.rb6
-rwxr-xr-xacceptance/tests/resource/file/should_create_symlink.rb5
-rwxr-xr-xacceptance/tests/resource/file/should_remove_dir.rb2
-rwxr-xr-xacceptance/tests/resource/file/should_remove_file.rb2
-rw-r--r--acceptance/tests/resource/file/source_attribtute.rb30
-rwxr-xr-xacceptance/tests/resource/group/should_create.rb4
-rwxr-xr-xacceptance/tests/resource/group/should_modify_gid.rb19
-rwxr-xr-xacceptance/tests/resource/host/should_create.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_create_aliases.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_destroy.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_modify_alias.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_modify_ip.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_not_create_existing.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_query.rb2
-rwxr-xr-xacceptance/tests/resource/host/should_query_all.rb2
-rwxr-xr-xacceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb7
-rwxr-xr-xacceptance/tests/resource/user/should_create.rb14
-rwxr-xr-xacceptance/tests/resource/user/should_create_with_gid.rb6
-rwxr-xr-xacceptance/tests/resource/user/should_destroy.rb2
-rwxr-xr-xacceptance/tests/resource/user/should_modify_gid.rb6
-rwxr-xr-xacceptance/tests/resource/user/should_not_destoy_unexisting.rb2
-rwxr-xr-xacceptance/tests/resource/user/should_query.rb2
29 files changed, 119 insertions, 96 deletions
diff --git a/acceptance/tests/resource/cron/should_create_cron.rb b/acceptance/tests/resource/cron/should_create_cron.rb
index e45561491..5badac05f 100644
--- a/acceptance/tests/resource/cron/should_create_cron.rb
+++ b/acceptance/tests/resource/cron/should_create_cron.rb
@@ -1,6 +1,6 @@
test_name "should create cron"
-tmpuser = "cron-test-#{Time.new.to_i}"
+tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
create_user = "user { '#{tmpuser}': ensure => present, managehome => false }"
@@ -18,13 +18,13 @@ agents.each do |host|
end
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
+ run_cron_on(host, :list, tmpuser) do
fail_test "didn't find the command as expected" unless
stdout.include? "* * * * * /bin/true"
end
step "remove the crontab file for that user"
- on host, "crontab -r -u #{tmpuser}"
+ run_cron_on(host, :remove, tmpuser)
step "remove the user from the system"
apply_manifest_on host, delete_user
diff --git a/acceptance/tests/resource/cron/should_match_existing.rb b/acceptance/tests/resource/cron/should_match_existing.rb
index b34a0498c..b5c5d359d 100755
--- a/acceptance/tests/resource/cron/should_match_existing.rb
+++ b/acceptance/tests/resource/cron/should_match_existing.rb
@@ -1,6 +1,6 @@
+test_name "puppet should match existing job"
-
-tmpuser = "cron-test-#{Time.new.to_i}"
+tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
create_user = "user { '#{tmpuser}': ensure => present, managehome => false }"
@@ -11,14 +11,11 @@ agents.each do |host|
apply_manifest_on host, create_user
step "create the existing job by hand..."
- on host, "echo '* * * * * /bin/true' | crontab -u #{tmpuser} -"
+ run_cron_on(host,:add,tmpuser,"* * * * * /bin/true")
step "apply the resource on the host using puppet resource"
on(host, puppet_resource("cron", "crontest", "user=#{tmpuser}",
"command=/bin/true", "ensure=present")) do
- # REVISIT: This is ported from the original test, which seems to me a
- # weak test, but I don't want to improve it now. --daniel 2010-12-23
- #
# This is a weak/fragile test. The output has changed
# causing this test to fail erronously. Changed to the correct
# output to match, but this code should be re-feactored.
@@ -27,13 +24,13 @@ agents.each do |host|
end
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
+ run_cron_on(host, :list, tmpuser) do
fail_test "didn't find the command as expected" unless
stdout.include? "* * * * * /bin/true"
end
step "remove the crontab file for that user"
- on host, "crontab -r -u #{tmpuser}"
+ run_cron_on(host, :remove, tmpuser)
step "remove the user from the system"
apply_manifest_on host, delete_user
diff --git a/acceptance/tests/resource/cron/should_remove_cron.rb b/acceptance/tests/resource/cron/should_remove_cron.rb
index 035a0f7b9..9956d0d71 100755
--- a/acceptance/tests/resource/cron/should_remove_cron.rb
+++ b/acceptance/tests/resource/cron/should_remove_cron.rb
@@ -1,6 +1,6 @@
test_name "puppet should remove a crontab entry as expected"
-tmpuser = "cron-test-#{Time.new.to_i}"
+tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
create_user = "user { '#{tmpuser}': ensure => present, managehome => false }"
@@ -11,7 +11,7 @@ agents.each do |host|
apply_manifest_on host, create_user
step "create the existing job by hand..."
- on host, "printf '# Puppet Name: crontest\n* * * * * /bin/true\n' | crontab -u #{tmpuser} -"
+ run_cron_on(host,:add,tmpuser,"* * * * * /bin/true")
step "apply the resource on the host using puppet resource"
on(host, puppet_resource("cron", "crontest", "user=#{tmpuser}",
@@ -23,13 +23,13 @@ agents.each do |host|
end
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
- fail_test "didn't found the command we tried to remove" if
- stdout.include? "/bin/true"
+ run_cron_on(host, :list, tmpuser) do
+ fail_test "didn't found the command we tried to remove" if
+ stdout.include? "/bin/true"
end
step "remove the crontab file for that user"
- on host, "crontab -r -u #{tmpuser}"
+ run_cron_on(host, :remove, tmpuser)
step "remove the user from the system"
apply_manifest_on host, delete_user
diff --git a/acceptance/tests/resource/cron/should_remove_matching.rb b/acceptance/tests/resource/cron/should_remove_matching.rb
index e669f2959..f4de0de0c 100755
--- a/acceptance/tests/resource/cron/should_remove_matching.rb
+++ b/acceptance/tests/resource/cron/should_remove_matching.rb
@@ -1,6 +1,6 @@
test_name "puppet should remove a crontab entry based on command matching"
-tmpuser = "cron-test-#{Time.new.to_i}"
+tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
cron = '# Puppet Name: crontest\n* * * * * /bin/true\n1 1 1 1 1 /bin/true\n'
@@ -13,7 +13,7 @@ agents.each do |host|
apply_manifest_on host, create_user
step "create the existing job by hand..."
- on host, "printf '#{cron}' | crontab -u #{tmpuser} -"
+ run_cron_on(host,:add,tmpuser,"* * * * * /bin/true")
step "apply the resource change on the host"
on(host, puppet_resource("cron", "bogus", "user=#{tmpuser}",
@@ -23,13 +23,13 @@ agents.each do |host|
end
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
+ run_cron_on(host,:list,tmpuser) do
count = stdout.scan("/bin/true").length
fail_test "found /bin/true the wrong number of times (#{count})" unless count == 1
end
step "remove the crontab file for that user"
- on host, "crontab -r -u #{tmpuser}"
+ run_cron_on(host,:remove,tmpuser)
step "remove the user from the system"
apply_manifest_on host, delete_user
diff --git a/acceptance/tests/resource/cron/should_update_existing.rb b/acceptance/tests/resource/cron/should_update_existing.rb
index 3a2a53769..ff179307f 100755
--- a/acceptance/tests/resource/cron/should_update_existing.rb
+++ b/acceptance/tests/resource/cron/should_update_existing.rb
@@ -1,10 +1,8 @@
test_name "puppet should update existing crontab entry"
-tmpuser = "cron-test-#{Time.new.to_i}"
+tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
-cron = '# Puppet Name: crontest\n* * * * * /bin/true\n'
-
create_user = "user { '#{tmpuser}': ensure => present, managehome => false }"
delete_user = "user { '#{tmpuser}': ensure => absent, managehome => false }"
@@ -13,10 +11,10 @@ agents.each do |host|
apply_manifest_on host, create_user
step "create the existing job by hand..."
- on host, "printf '#{cron}' | crontab -u #{tmpuser} -"
+ run_cron_on(host,:add,tmpuser,"* * * * * /bin/true")
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
+ run_cron_on(host,:list,tmpuser) do
fail_test "didn't find the content in the crontab" unless
stdout.include? '* * * * * /bin/true'
end
@@ -25,17 +23,17 @@ agents.each do |host|
on(host, puppet_resource("cron", "crontest", "user=#{tmpuser}",
"command=/bin/true", "ensure=present", "hour='0-6'")) do
fail_test "didn't update the time as expected" unless
- stdout.include? "defined 'hour' as '0-6'"
+ stdout.include? "hour => ['0-6']"
end
step "verify that crontab -l contains what you expected"
- on host, "crontab -l -u #{tmpuser}" do
+ run_cron_on(host,:list,tmpuser) do
fail_test "didn't find the content in the crontab" unless
stdout.include? '* 0-6 * * * /bin/true'
end
step "remove the crontab file for that user"
- on host, "crontab -r -u #{tmpuser}"
+ run_cron_on(host,:remove,tmpuser)
step "remove the user from the system"
apply_manifest_on host, delete_user
diff --git a/acceptance/tests/resource/file/content_attribute.rb b/acceptance/tests/resource/file/content_attribute.rb
index 4458e07a4..31dbac151 100644
--- a/acceptance/tests/resource/file/content_attribute.rb
+++ b/acceptance/tests/resource/file/content_attribute.rb
@@ -1,25 +1,33 @@
-test_name "The content attribute"
-pass_test "Pass forced pending test failure investigation"
+test_name "Content Attribute"
step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/content_file_test.txt'
-step "When using raw content"
+step "Content Attribute: using raw content"
manifest = "file { '/tmp/content_file_test.txt': content => 'This is the test file content', ensure => present }"
apply_manifest_on agents, manifest
-on agents, 'test "$(cat /tmp/content_file_test.txt)" = "This is the test file content"'
+agents.each do |host|
+ on host, "cat /tmp/content_file_test.txt" do
+ assert_match(/This is the test file content/, stdout, "File content not matched on #{host}")
+ end
+end
step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/content_file_test.txt'
-step "When using a filebucket checksum from filebucket"
-
+step "Content Attribute: using a checksum from filebucket"
on agents, "echo 'This is the checksum file contents' > /tmp/checksum_test_file.txt"
-on agents, "puppet filebucket backup --local /tmp/checksum_test_file.txt"
+step "Backup file into the filebucket"
+on agents, puppet_filebucket("backup --local /tmp/checksum_test_file.txt")
+
+agents.each do |agent|
+ bucketdir="not set"
+ on agent, puppet_filebucket("--configprint bucketdir") do
+ bucketdir = stdout.chomp
+ end
-get_remote_option(agents, 'filebucket', 'bucketdir') do |bucketdir|
manifest = %Q|
filebucket { 'local':
path => '#{bucketdir}',
@@ -31,7 +39,14 @@ get_remote_option(agents, 'filebucket', 'bucketdir') do |bucketdir|
backup => local,
}
|
- apply_manifest_on agents, manifest
+
+ step "Applying Manifest on Agents"
+ apply_manifest_on agent, manifest
end
-on agents, 'test "$(cat /tmp/content_file_test.txt)" = "This is the checksum file contents"'
+step "Validate filebucket checksum file contents"
+agents.each do |host|
+ on host, "cat /tmp/content_file_test.txt" do
+ assert_match(/This is the checksum file content/, stdout, "File content not matched on #{host}")
+ end
+end
diff --git a/acceptance/tests/resource/file/should_create_directory.rb b/acceptance/tests/resource/file/should_create_directory.rb
index 859ebb3ba..37ad9dbf8 100755
--- a/acceptance/tests/resource/file/should_create_directory.rb
+++ b/acceptance/tests/resource/file/should_create_directory.rb
@@ -3,7 +3,7 @@ test_name "should create directory"
target = "/tmp/test-#{Time.new.to_i}"
step "clean up the system before we begin"
-on agents, "rm -vrf #{target}"
+on agents, "rm -rf #{target}"
step "verify we can create a directory"
on(agents, puppet_resource("file", target, 'ensure=directory'))
@@ -12,4 +12,4 @@ step "verify the directory was created"
on agents, "test -d #{target}"
step "clean up after the test run"
-on agents, "rm -vrf #{target}"
+on agents, "rm -rf #{target}"
diff --git a/acceptance/tests/resource/file/should_create_empty.rb b/acceptance/tests/resource/file/should_create_empty.rb
index a38c35c2d..e9d9d8e27 100755
--- a/acceptance/tests/resource/file/should_create_empty.rb
+++ b/acceptance/tests/resource/file/should_create_empty.rb
@@ -3,13 +3,13 @@ test_name "should create empty file for 'present'"
target = "/tmp/test-#{Time.new.to_i}"
step "clean up the system before we begin"
-on agents, "rm -vrf #{target}"
+on agents, "rm -rf #{target}"
step "verify we can create an empty file"
on(agents, puppet_resource("file", target, 'ensure=present'))
step "verify the target was created"
-on agents, "test -f #{target} && ! test -s #{target}"
+on agents, "test -f #{target} && test ! -s #{target}"
step "clean up after the test run"
-on agents, "rm -vrf #{target}"
+on agents, "rm -rf #{target}"
diff --git a/acceptance/tests/resource/file/should_create_symlink.rb b/acceptance/tests/resource/file/should_create_symlink.rb
index 0e58d213b..81fe4b4e3 100755
--- a/acceptance/tests/resource/file/should_create_symlink.rb
+++ b/acceptance/tests/resource/file/should_create_symlink.rb
@@ -5,7 +5,7 @@ target = "/tmp/test-#{Time.new.to_i}"
source = "/tmp/test-#{Time.new.to_i}-source"
step "clean up the system before we begin"
-on agents, "rm -vrf #{target}"
+on agents, "rm -rf #{target}"
on agents, "echo '#{message}' > #{source}"
step "verify we can create a symlink"
@@ -13,6 +13,7 @@ on(agents, puppet_resource("file", target, "ensure=#{source}"))
step "verify the symlink was created"
on agents, "test -L #{target} && test -f #{target}"
+step "verify source file"
on agents, "test -f #{source}"
step "verify the content is identical on both sides"
@@ -24,4 +25,4 @@ on(agents, "cat #{target}") do
end
step "clean up after the test run"
-on agents, "rm -vrf #{target} #{source}"
+on agents, "rm -rf #{target} #{source}"
diff --git a/acceptance/tests/resource/file/should_remove_dir.rb b/acceptance/tests/resource/file/should_remove_dir.rb
index 943410d20..36fa1adee 100755
--- a/acceptance/tests/resource/file/should_remove_dir.rb
+++ b/acceptance/tests/resource/file/should_remove_dir.rb
@@ -3,7 +3,7 @@ test_name "should remove directory, but force required"
target = "/tmp/test-#{Time.new.to_i}"
step "clean up the system before we begin"
-on agents, "test -e #{target} && rm -vrf #{target} ; mkdir -p #{target}"
+on agents, "rm -rf #{target} ; mkdir -p #{target}"
step "verify we can't remove a directory without 'force'"
on(agents, puppet_resource("file", target, 'ensure=absent')) do
diff --git a/acceptance/tests/resource/file/should_remove_file.rb b/acceptance/tests/resource/file/should_remove_file.rb
index 3ad7510ad..aadb82971 100755
--- a/acceptance/tests/resource/file/should_remove_file.rb
+++ b/acceptance/tests/resource/file/should_remove_file.rb
@@ -3,7 +3,7 @@ test_name "should remove file"
target = "/tmp/test-#{Time.new.to_i}"
step "clean up the system before we begin"
-on agents, "rm -vrf #{target} && touch #{target}"
+on agents, "rm -rf #{target} && touch #{target}"
step "verify we can remove a file"
on(agents, puppet_resource("file", target, 'ensure=absent'))
diff --git a/acceptance/tests/resource/file/source_attribtute.rb b/acceptance/tests/resource/file/source_attribtute.rb
index 95a7f36b3..3fa447a8a 100644
--- a/acceptance/tests/resource/file/source_attribtute.rb
+++ b/acceptance/tests/resource/file/source_attribtute.rb
@@ -4,35 +4,41 @@ step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/source_file_test.txt'
# TODO: Add tests for puppet:// URIs with master/agent setups.
-step "when using a puppet:/// URI with a master/agent setup"
-step "when using a puppet://$server/ URI with a master/agent setup"
-
-step "when using a local file path"
+# step "when using a puppet:/// URI with a master/agent setup"
+# step "when using a puppet://$server/ URI with a master/agent setup"
+step "Using a local file path"
on agents, "echo 'Yay, this is the local file.' > /tmp/local_source_file_test.txt"
-
manifest = "file { '/tmp/source_file_test.txt': source => '/tmp/local_source_file_test.txt', ensure => present }"
apply_manifest_on agents, manifest
-
-on agents, 'test "$(cat /tmp/source_file_test.txt)" = "Yay, this is the local file."'
+agents.each do |host|
+ on host, "cat /tmp/source_file_test.txt" do
+ assert_match(/Yay, this is the local file./, stdout, "FIRST: File contents not matched on #{host}")
+ end
+end
step "Ensure the test environment is clean"
on agents, 'rm -f /tmp/source_file_test.txt'
-step "when using a puppet:/// URI with puppet apply"
+step "Using a puppet:/// URI with puppet apply"
-on agents, 'puppet agent --configprint modulepath' do
+on agents, puppet_agent("--configprint modulepath") do
modulepath = stdout.split(':')[0]
modulepath = modulepath.chomp
on agents, "mkdir -p #{modulepath}/test_module/files"
- on agents, "echo 'Yay, this is the puppet:/// file.' > #{modulepath}/test_module/files/test_file.txt"
+ #on agents, "echo 'Yay, this is the puppet:/// file.' > #{modulepath}/test_module/files/test_file.txt"
+ on agents, "echo 'Yay, this is the puppetfile.' > #{modulepath}/test_module/files/test_file.txt"
end
on agents, %q{echo "file { '/tmp/source_file_test.txt': source => 'puppet:///modules/test_module/test_file.txt', ensure => present }" > /tmp/source_test_manifest.pp}
-on agents, "puppet apply /tmp/source_test_manifest.pp"
+on agents, puppet_apply("/tmp/source_test_manifest.pp")
-on agents, 'test "$(cat /tmp/source_file_test.txt)" = "Yay, this is the puppet:/// file."'
+agents.each do |host|
+ on host, "cat /tmp/source_file_test.txt" do
+ assert_match(/Yay, this is the puppetfile./, stdout, "SECOND: File contents not matched on #{host}")
+ end
+end
# Oops. We (Jesse & Jacob) ended up writing this before realizing that you
# can't actually specify "source => 'http://...'". However, we're leaving it
diff --git a/acceptance/tests/resource/group/should_create.rb b/acceptance/tests/resource/group/should_create.rb
index 122c31a8f..efb80a4bc 100755
--- a/acceptance/tests/resource/group/should_create.rb
+++ b/acceptance/tests/resource/group/should_create.rb
@@ -1,6 +1,6 @@
test_name "should create group"
-name = "test-group-#{Time.new.to_i}"
+name = "pl#{rand(999999).to_i}"
def cleanup(name)
step "remove group #{name} if it exists"
@@ -14,7 +14,7 @@ on(agents, puppet_resource('group', name, 'ensure=present'))
step "verify the group #{name} was created"
on(agents, "getent group #{name}") do
- fail_test "group information is not sensible" unless stdout =~ /^#{name}:x:[0-9]+:/
+ fail_test "group information is not sensible" unless stdout =~ /^#{name}:.*:[0-9]+:/
end
cleanup(name)
diff --git a/acceptance/tests/resource/group/should_modify_gid.rb b/acceptance/tests/resource/group/should_modify_gid.rb
index 95405b24c..b54d40118 100755
--- a/acceptance/tests/resource/group/should_modify_gid.rb
+++ b/acceptance/tests/resource/group/should_modify_gid.rb
@@ -1,22 +1,23 @@
test_name "should modify gid of existing group"
-name = "test-group-#{Time.new.to_i}"
-gid = 12345
+name = "pl#{rand(999999).to_i}"
+gid1 = rand(999999).to_i
+gid2 = rand(999999).to_i
-step "ensure that the group exists with gid #{gid}"
-on(agents, puppet_resource('group', name, 'ensure=present', "gid=#{gid}")) do
- fail_test "missing gid notice" unless stdout =~ /gid +=> +'#{gid}'/
+step "ensure that the group exists with gid #{gid1}"
+on(agents, puppet_resource('group', name, 'ensure=present', "gid=#{gid1}")) do
+ fail_test "missing gid notice" unless stdout =~ /gid +=> +'#{gid1}'/
end
-step "ensure that we can modify the GID of the group to #{gid*2}"
-on(agents, puppet_resource('group', name, 'ensure=present', "gid=#{gid*2}")) do
- fail_test "missing gid notice" unless stdout =~ /gid +=> +'#{gid*2}'/
+step "ensure that we can modify the GID of the group to #{gid2}"
+on(agents, puppet_resource('group', name, 'ensure=present', "gid=#{gid2}")) do
+ fail_test "missing gid notice" unless stdout =~ /gid +=> +'#{gid2}'/
end
step "verify that the GID changed"
on(agents, "getent group #{name}") do
fail_test "gid is wrong through getent output" unless
- stdout =~ /^#{name}:x:#{gid*2}:/
+ stdout =~ /^#{name}:.*:#{gid2}:/
end
step "clean up the system after the test run"
diff --git a/acceptance/tests/resource/host/should_create.rb b/acceptance/tests/resource/host/should_create.rb
index d5bd9e6e7..f5c0a17a5 100755
--- a/acceptance/tests/resource/host/should_create.rb
+++ b/acceptance/tests/resource/host/should_create.rb
@@ -3,7 +3,7 @@ test_name "host should create"
target = "/tmp/host-#{Time.new.to_i}"
step "clean up for the test"
-on agents, "rm -vf #{target}"
+on agents, "rm -f #{target}"
step "create the host record"
on(agents, puppet_resource("host", "test", "ensure=present",
diff --git a/acceptance/tests/resource/host/should_create_aliases.rb b/acceptance/tests/resource/host/should_create_aliases.rb
index 4cc0014f6..71e92aef9 100755
--- a/acceptance/tests/resource/host/should_create_aliases.rb
+++ b/acceptance/tests/resource/host/should_create_aliases.rb
@@ -3,7 +3,7 @@ test_name "host should create aliases"
target = "/tmp/host-#{Time.new.to_i}"
step "clean up the system for testing"
-on agents, "rm -vf #{target}"
+on agents, "rm -f #{target}"
step "create the record"
on(agents, puppet_resource('host', 'test', "ensure=present",
diff --git a/acceptance/tests/resource/host/should_destroy.rb b/acceptance/tests/resource/host/should_destroy.rb
index 451b2d061..69c74b824 100755
--- a/acceptance/tests/resource/host/should_destroy.rb
+++ b/acceptance/tests/resource/host/should_destroy.rb
@@ -16,4 +16,4 @@ on(agents, "cat #{file}; rm -f #{file}") do
end
step "clean up after the test"
-on agents, "rm -vf #{file}"
+on agents, "rm -f #{file}"
diff --git a/acceptance/tests/resource/host/should_modify_alias.rb b/acceptance/tests/resource/host/should_modify_alias.rb
index 312078fef..1ebbf3339 100755
--- a/acceptance/tests/resource/host/should_modify_alias.rb
+++ b/acceptance/tests/resource/host/should_modify_alias.rb
@@ -16,4 +16,4 @@ on(agents, "cat #{file}; rm -f #{file}") do
end
step "clean up after the test"
-on agents, "rm -vf #{file}"
+on agents, "rm -f #{file}"
diff --git a/acceptance/tests/resource/host/should_modify_ip.rb b/acceptance/tests/resource/host/should_modify_ip.rb
index b16db5979..cf3c3f12d 100755
--- a/acceptance/tests/resource/host/should_modify_ip.rb
+++ b/acceptance/tests/resource/host/should_modify_ip.rb
@@ -16,4 +16,4 @@ on(agents, "cat #{file}; rm -f #{file}") do
end
step "clean up after the test"
-on agents, "rm -vf #{file}"
+on agents, "rm -f #{file}"
diff --git a/acceptance/tests/resource/host/should_not_create_existing.rb b/acceptance/tests/resource/host/should_not_create_existing.rb
index c8a40df93..a8f902286 100755
--- a/acceptance/tests/resource/host/should_not_create_existing.rb
+++ b/acceptance/tests/resource/host/should_not_create_existing.rb
@@ -13,5 +13,5 @@ on(agents, puppet_resource('host', 'test', "target=#{file}",
end
step "clean up after we created things"
-on agents, "rm -vf #{file}"
+on agents, "rm -f #{file}"
diff --git a/acceptance/tests/resource/host/should_query.rb b/acceptance/tests/resource/host/should_query.rb
index 983812ce0..76f84e498 100755
--- a/acceptance/tests/resource/host/should_query.rb
+++ b/acceptance/tests/resource/host/should_query.rb
@@ -12,4 +12,4 @@ on(agents, puppet_resource('host', 'localhost', "target=#{file}")) do
end
step "clean up the system"
-on agents, "rm -vf #{file}"
+on agents, "rm -f #{file}"
diff --git a/acceptance/tests/resource/host/should_query_all.rb b/acceptance/tests/resource/host/should_query_all.rb
index 654883aa0..bf1f1b89a 100755
--- a/acceptance/tests/resource/host/should_query_all.rb
+++ b/acceptance/tests/resource/host/should_query_all.rb
@@ -23,4 +23,4 @@ on(agents, puppet_resource('host')) do
end
step "clean up the system afterwards"
-on agents, "mv -vf #{backup} /etc/hosts"
+on agents, "mv -f #{backup} /etc/hosts"
diff --git a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb
index 9bedd6e04..127e943a9 100755
--- a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb
+++ b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb
@@ -4,9 +4,10 @@ step "Validate services running agreement ralsh vs. OS service count"
# ticket_4123_should_list_all_running_redhat.sh
hosts.each do |host|
- unless host['platform'].include? 'centos' or host['platform'].include? 'redhat'
- skip_test "Test not supported on this plaform"
- else
+ if host['platform'].include?('centos') or host['platform'].include?('redhat')
+ puts "XXX #{host['platform']}"
run_script_on(host,'acceptance-tests/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh')
+ else
+ skip_test "Test not supported on this plaform"
end
end
diff --git a/acceptance/tests/resource/user/should_create.rb b/acceptance/tests/resource/user/should_create.rb
index 062883da3..0b2b0c65f 100755
--- a/acceptance/tests/resource/user/should_create.rb
+++ b/acceptance/tests/resource/user/should_create.rb
@@ -1,9 +1,6 @@
test_name "should create a user, and the default matching group"
-# REVISIT: This is a direct port of the original test, but it contains a
-# non-portable assumption that "user private groups" are used by default by
-# everything that we target. --daniel 2010-12-24
-name = "test-user-#{Time.new.to_i}"
+name = "pl#{rand(999999).to_i}"
step "ensure that the user and group #{name} do not exist"
on agents, "if getent passwd #{name}; then userdel #{name}; fi"
@@ -13,7 +10,14 @@ step "ask puppet to create the user"
on(agents, puppet_resource('user', name, 'ensure=present'))
step "verify that the user and group now exist"
-on agents, "getent passwd #{name} && getent group #{name}"
+agents.each do |agent|
+ if agent['platform'].include? 'sles' or agent['platform'].include? 'solaris' # no private user groups by default
+ on agent, "getent passwd #{name}"
+ else
+ on agent, "getent passwd #{name} && getent group #{name}"
+ end
+end
+
step "ensure that the user and group #{name} do not exist"
on agents, "if getent passwd #{name}; then userdel #{name}; fi"
diff --git a/acceptance/tests/resource/user/should_create_with_gid.rb b/acceptance/tests/resource/user/should_create_with_gid.rb
index be36bf4e6..c92d5c95d 100755
--- a/acceptance/tests/resource/user/should_create_with_gid.rb
+++ b/acceptance/tests/resource/user/should_create_with_gid.rb
@@ -1,14 +1,14 @@
test_name "verifies that puppet resource creates a user and assigns the correct group"
-user = "test-user-#{Time.new.to_i}"
-group = "test-user-#{Time.new.to_i}-group"
+user = "pl#{rand(999999).to_i}"
+group = "gp#{rand(999999).to_i}"
agents.each do |host|
step "user should not exist"
on host, "if getent passwd #{user}; then userdel #{user}; fi"
step "group should exist"
- on host, "if ! getent group #{group}; then groupadd #{group}; fi"
+ on host, "getent group #{group} || groupadd #{group}"
step "create user with group"
on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group}"))
diff --git a/acceptance/tests/resource/user/should_destroy.rb b/acceptance/tests/resource/user/should_destroy.rb
index 8ba7ace41..655501231 100755
--- a/acceptance/tests/resource/user/should_destroy.rb
+++ b/acceptance/tests/resource/user/should_destroy.rb
@@ -1,6 +1,6 @@
test_name "verify that puppet resource correctly destroys users"
-user = "test-user-#{Time.new.to_i}"
+user = "pl#{rand(999999).to_i}"
group = user
step "ensure that the user and associated group exist"
diff --git a/acceptance/tests/resource/user/should_modify_gid.rb b/acceptance/tests/resource/user/should_modify_gid.rb
index 6aba4aa7a..d8bc60fc1 100755
--- a/acceptance/tests/resource/user/should_modify_gid.rb
+++ b/acceptance/tests/resource/user/should_modify_gid.rb
@@ -1,8 +1,8 @@
test_name "verify that we can modify the gid"
-user = "test-user-#{Time.new.to_i}"
-group1 = "#{user}-old"
-group2 = "#{user}-new"
+user = "pl#{rand(99999).to_i}"
+group1 = "#{user}old"
+group2 = "#{user}new"
agents.each do |host|
step "ensure that the groups both exist"
diff --git a/acceptance/tests/resource/user/should_not_destoy_unexisting.rb b/acceptance/tests/resource/user/should_not_destoy_unexisting.rb
index ceeea7da1..133d51395 100755
--- a/acceptance/tests/resource/user/should_not_destoy_unexisting.rb
+++ b/acceptance/tests/resource/user/should_not_destoy_unexisting.rb
@@ -1,6 +1,6 @@
test_name "ensure that puppet does not report removing a user that does not exist"
-name = "test-user-#{Time.new.to_i}"
+name = "pl#{rand(999999).to_i}"
step "verify that user #{name} does not exist"
on agents, "getent passwd #{name}", :acceptable_exit_codes => [2]
diff --git a/acceptance/tests/resource/user/should_query.rb b/acceptance/tests/resource/user/should_query.rb
index 6e2df534d..c976c878f 100755
--- a/acceptance/tests/resource/user/should_query.rb
+++ b/acceptance/tests/resource/user/should_query.rb
@@ -1,6 +1,6 @@
test_name "test that we can query and find a user that exists."
-name = "test-user-#{Time.new.to_i}"
+name = "pl#{rand(999999).to_i}"
step "ensure that our test user exists"
on(agents, puppet_resource('user', name, 'ensure=present'))