From 7b515e4845a3558f94b9115596c90271b9cfad67 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Wed, 22 May 2013 13:27:38 -0700 Subject: [PATCH] update ticket_* tests for 3.2 --- ...sclosure-when-changing-a-users-password.rb | 4 +- ...rovider_in_same_run_it_becomes_suitable.rb | 8 +++- ..._7165_no_refresh_after_starting_service.rb | 41 +++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 acceptance/tests/ticket_7165_no_refresh_after_starting_service.rb diff --git a/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb b/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb index fdcdd180a..97577c9d0 100644 --- a/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb +++ b/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb @@ -1,8 +1,8 @@ test_name "#6857: redact password hashes when applying in noop mode" hosts_to_test = agents.reject do |agent| - if agent['platform'].match /(?:ubuntu|centos|debian|el-)/ - result = on(agent, %q{ruby -e 'require "shadow" or raise'}, :silent => true) + if agent['platform'].match /(?:ubuntu|centos|debian|el-|fc-)/ + result = on(agent, %Q{#{agent['puppetbindir']}/ruby -e 'require "shadow" or raise'}, :silent => true) result.exit_code != 0 else false diff --git a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb index 2a5d11333..80ce01aba 100644 --- a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb +++ b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb @@ -14,7 +14,9 @@ TYPE on agent, "cat > #{dir}/lib/puppet/provider/test6907/only.rb", :stdin => < "#{dir}/must_exist" + # The name of the file is chosen to be *.exe so it works on windows and *nix + # becasue windows inspects the PATHEXT environment variable in 1.9.3 and later. + commands :anything => "#{dir}/must_exist.exe" require 'fileutils' def file @@ -32,7 +34,9 @@ PROVIDER file => "#{dir}/test_file", } - file { "#{dir}/must_exist": + # The name of the file is chosen to be *.exe so it works on windows and *nix + # becasue windows inspects the PATHEXT environment variable in 1.9.3 and later. + file { "#{dir}/must_exist.exe": ensure => file, mode => 0755, } diff --git a/acceptance/tests/ticket_7165_no_refresh_after_starting_service.rb b/acceptance/tests/ticket_7165_no_refresh_after_starting_service.rb new file mode 100644 index 000000000..f17caad94 --- /dev/null +++ b/acceptance/tests/ticket_7165_no_refresh_after_starting_service.rb @@ -0,0 +1,41 @@ +test_name "Bug #7165: Don't refresh service immediately after starting it" + +confine :except, :platform => 'windows' + +agents.each do |host| + dir = host.tmpdir('7165-no-refresh') + +manifest = %Q{ + file { "#{dir}/notify": + content => "foo", + notify => Service["service"], + } + + service { "service": + ensure => running, + hasstatus => true, + hasrestart => true, + status => "test -e #{dir}/service", + start => "touch #{dir}/service", + stop => "rm -f #{dir}/service", + restart => "touch #{dir}/service_restarted", + require => File["#{dir}/notify"], + provider => base, + } +} + + apply_manifest_on(host, manifest) do + on(host, "test -e #{dir}/service") + # service should not restart, since it wasn't running to begin with + on(host, "test -e #{dir}/service_restarted", :acceptable_exit_codes => [1]) + end + + # will trigger a notify next time as the file changes + on(host, "echo bar > #{dir}/notify") + + apply_manifest_on(host, manifest) do + on(host, "test -e #{dir}/service") + # service should restart this time + on(host, "test -e #{dir}/service_restarted") + end +end