diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-07-12 15:42:44 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-12 15:42:44 -0700 |
| commit | 06e0208ec34285e0749c366c8a12817044d7d513 (patch) | |
| tree | 94aac406b2fe9083bc3b6a7d068f633aeee3ecf1 | |
| parent | 9774c363c9ce11202f9170bf38028c812527ea76 (diff) | |
| download | puppet-06e0208ec34285e0749c366c8a12817044d7d513.tar.gz puppet-06e0208ec34285e0749c366c8a12817044d7d513.tar.xz puppet-06e0208ec34285e0749c366c8a12817044d7d513.zip | |
(#8268) Fix resource harness spec tests
The windows file type requires that the path start with either a drive
letter or UNC style path. Also Ruby's File implementation on windows
only supports 0644 and 0444 permission bits (it doesn't differentiate
between group and other, and it doesn't know about the execute bit).
This commit maps the path and permissions used in the test to sensible
values when running on windows.
Paired-with: Jacob Helwig <jacob@puppetlabs.com>
| -rwxr-xr-x | spec/unit/transaction/resource_harness_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 20a42d27b..a594d3669 100755 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -7,10 +7,14 @@ describe Puppet::Transaction::ResourceHarness do include PuppetSpec::Files before do + @mode_750 = Puppet.features.microsoft_windows? ? '644' : '750' + @mode_755 = Puppet.features.microsoft_windows? ? '644' : '755' + path = Puppet.features.microsoft_windows? ? "c:/my/file" : "/my/file" + @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new) - @resource = Puppet::Type.type(:file).new :path => "/my/file" + @resource = Puppet::Type.type(:file).new :path => path @harness = Puppet::Transaction::ResourceHarness.new(@transaction) - @current_state = Puppet::Resource.new(:file, "/my/file") + @current_state = Puppet::Resource.new(:file, path) @resource.stubs(:retrieve).returns @current_state @status = Puppet::Resource::Status.new(@resource) Puppet::Resource::Status.stubs(:new).returns @status @@ -148,8 +152,8 @@ describe Puppet::Transaction::ResourceHarness do describe "when applying changes" do [false, true].each do |noop_mode|; describe (noop_mode ? "in noop mode" : "in normal mode") do - [nil, '750'].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do - [nil, '750', '755'].each do |yaml_mode| + [nil, @mode_750].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do + [nil, @mode_750, @mode_755].each do |yaml_mode| [nil, :file, :absent].each do |yaml_ensure|; describe "with mode=#{yaml_mode.inspect} and ensure=#{yaml_ensure.inspect} stored in state.yml" do [false, true].each do |auditing_ensure| [false, true].each do |auditing_mode| @@ -157,7 +161,7 @@ describe Puppet::Transaction::ResourceHarness do auditing.push(:mode) if auditing_mode auditing.push(:ensure) if auditing_ensure [nil, :file, :absent].each do |ensure_property| # what we set "ensure" to in the manifest - [nil, '750', '755'].each do |mode_property| # what we set "mode" to in the manifest + [nil, @mode_750, @mode_755].each do |mode_property| # what we set "mode" to in the manifest manifest_settings = {} manifest_settings[:audit] = auditing if !auditing.empty? manifest_settings[:ensure] = ensure_property if ensure_property |
