Please review pull request #736: Update acceptance tests to use confine instead of skip_test loops opened by (mkincaid)
Description:
This is a counterpart to #734: this pull request addresses tests in the 2.7.x branch.
- Opened: Thu May 03 01:21:44 UTC 2012
- Based on: puppetlabs:2.7.x (94dee104ddb833482ce2356ab3aa33fa9d3d5fb2)
- Requested merge: mkincaid:27confines (ebf538665e815c186867cf18be131dd67b24d9d3)
Diff follows:
diff --git a/acceptance/tests/allow_symlinks_as_config_directories.rb b/acceptance/tests/allow_symlinks_as_config_directories.rb
index 1f450fe..c8c8bbb 100644
--- a/acceptance/tests/allow_symlinks_as_config_directories.rb
+++ b/acceptance/tests/allow_symlinks_as_config_directories.rb
@@ -1,11 +1,7 @@
test_name "Should allow symlinks to directories as configuration directories"
+confine :except, :platform => 'windows'
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "Create the test confdir with a link to it"
confdir = agent.tmpdir('puppet_conf-directory')
conflink = agent.tmpfile('puppet_conf-symlink')
diff --git a/acceptance/tests/resource/cron/should_create_cron.rb b/acceptance/tests/resource/cron/should_create_cron.rb
index 6a1d5c0..92e9c6f 100644
--- a/acceptance/tests/resource/cron/should_create_cron.rb
+++ b/acceptance/tests/resource/cron/should_create_cron.rb
@@ -1,4 +1,5 @@
test_name "should create cron"
+confine :except, :platform => 'windows'
tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
@@ -9,11 +10,6 @@
package_cron = "case $operatingsystem { centos, redhat: {$cron = 'cronie'}\n default: {$cron ='cron'} } package {'cron': name=> $cron, ensure=>present, }"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure the user exist via puppet"
apply_manifest_on host, create_user
apply_manifest_on host, package_cron
diff --git a/acceptance/tests/resource/cron/should_match_existing.rb b/acceptance/tests/resource/cron/should_match_existing.rb
index e6b5080..81b480f 100755
--- a/acceptance/tests/resource/cron/should_match_existing.rb
+++ b/acceptance/tests/resource/cron/should_match_existing.rb
@@ -1,4 +1,5 @@
test_name "puppet should match existing job"
+confine :except, :platform => 'windows'
tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
@@ -9,11 +10,6 @@
package_cron = "case $operatingsystem { centos, redhat: {$cron = 'cronie'}\n default: {$cron ='cron'} } package {'cron': name=> $cron, ensure=>present, }"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure the user exist via puppet"
apply_manifest_on host, create_user
apply_manifest_on host, package_cron
diff --git a/acceptance/tests/resource/cron/should_remove_cron.rb b/acceptance/tests/resource/cron/should_remove_cron.rb
index fa72f5a..760316a 100755
--- a/acceptance/tests/resource/cron/should_remove_cron.rb
+++ b/acceptance/tests/resource/cron/should_remove_cron.rb
@@ -1,4 +1,5 @@
test_name "puppet should remove a crontab entry as expected"
+confine :except, :platform => 'windows'
tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
@@ -9,11 +10,6 @@
package_cron = "case $operatingsystem { centos, redhat: {$cron = 'cronie'}\n default: {$cron ='cron'} } package {'cron': name=> $cron, ensure=>present, }"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure the user exist via puppet"
apply_manifest_on host, create_user
apply_manifest_on host, package_cron
diff --git a/acceptance/tests/resource/cron/should_remove_matching.rb b/acceptance/tests/resource/cron/should_remove_matching.rb
index f480867..0b7115a 100755
--- a/acceptance/tests/resource/cron/should_remove_matching.rb
+++ b/acceptance/tests/resource/cron/should_remove_matching.rb
@@ -1,4 +1,5 @@
test_name "puppet should remove a crontab entry based on command matching"
+confine :except, :platform => 'windows'
tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
@@ -11,11 +12,6 @@
package_cron = "case $operatingsystem { centos, redhat: {$cron = 'cronie'}\n default: {$cron ='cron'} } package {'cron': name=> $cron, ensure=>present, }"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure the user exist via puppet"
apply_manifest_on host, create_user
apply_manifest_on host, package_cron
diff --git a/acceptance/tests/resource/cron/should_update_existing.rb b/acceptance/tests/resource/cron/should_update_existing.rb
index 1bd69b8..2b4926a 100755
--- a/acceptance/tests/resource/cron/should_update_existing.rb
+++ b/acceptance/tests/resource/cron/should_update_existing.rb
@@ -1,4 +1,5 @@
test_name "puppet should update existing crontab entry"
+confine :except, :platform => 'windows'
tmpuser = "pl#{rand(999999).to_i}"
tmpfile = "/tmp/cron-test-#{Time.new.to_i}"
@@ -9,11 +10,6 @@
package_cron = "case $operatingsystem { centos, redhat: {$cron = 'cronie'}\n default: {$cron ='cron'} } package {'cron': name=> $cron, ensure=>present, }"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure the user exist via puppet"
apply_manifest_on host, create_user
apply_manifest_on host, package_cron
diff --git a/acceptance/tests/resource/exec/accept_multi-line_commands.rb b/acceptance/tests/resource/exec/accept_multi-line_commands.rb
index dafd86c..443c7d2 100644
--- a/acceptance/tests/resource/exec/accept_multi-line_commands.rb
+++ b/acceptance/tests/resource/exec/accept_multi-line_commands.rb
@@ -1,11 +1,7 @@
test_name "Be able to execute multi-line commands (#9996)"
+confine :except, :platform => 'windows'
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
temp_file_name = agent.tmpfile('9996-multi-line-commands')
test_manifest = <<HERE
diff --git a/acceptance/tests/resource/file/should_create_symlink.rb b/acceptance/tests/resource/file/should_create_symlink.rb
index 0721bb2..7889f62 100755
--- a/acceptance/tests/resource/file/should_create_symlink.rb
+++ b/acceptance/tests/resource/file/should_create_symlink.rb
@@ -1,15 +1,11 @@
test_name "should create symlink"
+confine :except, :platform => 'windows'
message = 'hello world'
target = "/tmp/test-#{Time.new.to_i}"
source = "/tmp/test-#{Time.new.to_i}-source"
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "clean up the system before we begin"
on agent, "rm -rf #{target}"
on agent, "echo '#{message}' > #{source}"
diff --git a/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb b/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb
index a918f8c..f5b2592 100644
--- a/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb
+++ b/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb
@@ -1,13 +1,9 @@
test_name "#8740: should not enumerate root directory"
+confine :except, :platform => 'windows'
target = "/test-socket-#{$$}"
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "clean up the system before we begin"
on(agent, "rm -f #{target}")
diff --git a/acceptance/tests/resource/group/should_modify_gid.rb b/acceptance/tests/resource/group/should_modify_gid.rb
index 65e9a1f..43ba6fa 100755
--- a/acceptance/tests/resource/group/should_modify_gid.rb
+++ b/acceptance/tests/resource/group/should_modify_gid.rb
@@ -1,15 +1,11 @@
test_name "should modify gid of existing group"
+confine :except, :platform => 'windows'
name = "pl#{rand(999999).to_i}"
gid1 = rand(999999).to_i
gid2 = rand(999999).to_i
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
step "ensure that the group exists with gid #{gid1}"
on(agent, puppet_resource('group', name, 'ensure=present', "gid=#{gid1}")) do
fail_test "missing gid notice" unless stdout =~ /gid +=> +'#{gid1}'/
diff --git a/acceptance/tests/resource/user/should_create_with_gid.rb b/acceptance/tests/resource/user/should_create_with_gid.rb
index 0b9f00d..1cafe8f 100755
--- a/acceptance/tests/resource/user/should_create_with_gid.rb
+++ b/acceptance/tests/resource/user/should_create_with_gid.rb
@@ -1,34 +1,31 @@
test_name "verifies that puppet resource creates a user and assigns the correct group"
+confine :except, :platform => 'windows'
user = "pl#{rand(999999).to_i}"
group = "gp#{rand(999999).to_i}"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- else
- step "user should not exist"
- on host, "if getent passwd #{user}; then userdel #{user}; fi"
+ step "user should not exist"
+ on host, "if getent passwd #{user}; then userdel #{user}; fi"
- step "group should exist"
- on host, "getent group #{group} || groupadd #{group}"
+ step "group should exist"
+ on host, "getent group #{group} || groupadd #{group}"
- step "create user with group"
- on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group}"))
+ step "create user with group"
+ on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group}"))
- step "verify the group exists and find the gid"
- on(host, "getent group #{group}") do
- gid = stdout.split(':')[2]
+ step "verify the group exists and find the gid"
+ on(host, "getent group #{group}") do
+ gid = stdout.split(':')[2]
- step "verify that the user has that as their gid"
- on(host, "getent passwd #{user}") do
- got = stdout.split(':')[3]
- fail_test "wanted gid #{gid} but found #{got}" unless gid == got
- end
- end
-
- step "clean up after the test is done"
- on(host, puppet_resource('user', user, 'ensure=absent'))
- on(host, puppet_resource('group', group, 'ensure=absent'))
+ step "verify that the user has that as their gid"
+ on(host, "getent passwd #{user}") do
+ got = stdout.split(':')[3]
+ fail_test "wanted gid #{gid} but found #{got}" unless gid == got
+ end
end
+
+ step "clean up after the test is done"
+ on(host, puppet_resource('user', user, 'ensure=absent'))
+ on(host, puppet_resource('group', group, 'ensure=absent'))
end
diff --git a/acceptance/tests/resource/user/should_modify_gid.rb b/acceptance/tests/resource/user/should_modify_gid.rb
index 4c13dc4..850a3a7 100755
--- a/acceptance/tests/resource/user/should_modify_gid.rb
+++ b/acceptance/tests/resource/user/should_modify_gid.rb
@@ -1,45 +1,42 @@
test_name "verify that we can modify the gid"
+confine :except, :platform => 'windows'
user = "pl#{rand(99999).to_i}"
group1 = "#{user}old"
group2 = "#{user}new"
agents.each do |host|
- if host['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- else
- step "ensure that the groups both exist"
- on(host, puppet_resource('group', group1, 'ensure=present'))
- on(host, puppet_resource('group', group2, 'ensure=present'))
-
- step "ensure the user exists and has the old group"
- on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group1}"))
-
- step "verify that the user has the correct gid"
- on(host, "getent group #{group1}") do
- gid = stdout.split(':')[2]
- on(host, "getent passwd #{user}") do
- got = stdout.split(':')[3]
- fail_test "didn't have the expected old GID, but #{got}" unless got == gid
- end
- end
-
- step "modify the GID of the user"
- on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group2}"))
-
-
- step "verify that the user has the updated gid"
- on(host, "getent group #{group2}") do
- gid = stdout.split(':')[2]
- on(host, "getent passwd #{user}") do
- got = stdout.split(':')[3]
- fail_test "didn't have the expected old GID, but #{got}" unless got == gid
- end
- end
-
- step "ensure that we remove the things we made"
- on(host, puppet_resource('user', user, 'ensure=absent'))
- on(host, puppet_resource('group', group1, 'ensure=absent'))
- on(host, puppet_resource('group', group2, 'ensure=absent'))
+ step "ensure that the groups both exist"
+ on(host, puppet_resource('group', group1, 'ensure=present'))
+ on(host, puppet_resource('group', group2, 'ensure=present'))
+
+ step "ensure the user exists and has the old group"
+ on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group1}"))
+
+ step "verify that the user has the correct gid"
+ on(host, "getent group #{group1}") do
+ gid = stdout.split(':')[2]
+ on(host, "getent passwd #{user}") do
+ got = stdout.split(':')[3]
+ fail_test "didn't have the expected old GID, but #{got}" unless got == gid
+ end
end
+
+ step "modify the GID of the user"
+ on(host, puppet_resource('user', user, 'ensure=present', "gid=#{group2}"))
+
+
+ step "verify that the user has the updated gid"
+ on(host, "getent group #{group2}") do
+ gid = stdout.split(':')[2]
+ on(host, "getent passwd #{user}") do
+ got = stdout.split(':')[3]
+ fail_test "didn't have the expected old GID, but #{got}" unless got == gid
+ end
+ end
+
+ step "ensure that we remove the things we made"
+ on(host, puppet_resource('user', user, 'ensure=absent'))
+ on(host, puppet_resource('group', group1, 'ensure=absent'))
+ on(host, puppet_resource('group', group2, 'ensure=absent'))
end
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 3f41aeb..09a0b5e 100644
--- a/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb
+++ b/acceptance/tests/ticket_3961_puppet_ca_should_produce_certs.rb
@@ -1,4 +1,5 @@
test_name "#3961: puppet ca should produce certs spec"
+confine :except, :platform => 'windows'
target = "working3961.example.org"
@@ -9,11 +10,6 @@
'notice: Removing file Puppet::SSL::CertificateRequest working3961.example.org']
agents.each do |agent|
- if agent['platform'].include?('windows')
- skip_test "Test not supported on this platform"
- next
- end
-
scratch = agent.tmpdir('puppet-ssl-3961')
options = { :confdir => scratch, :vardir => scratch }
-- 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.
