summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2011-07-18 23:05:35 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:48:29 -0700
commitc26f3e5f79fa2caa17d18be41e32871ac09b1dc4 (patch)
treea27fb91f82ba4e98bb4ed4281151a150f0b51fac /spec/integration
parentbfeb33734358528209221be09b97ffc8513d3f87 (diff)
downloadpuppet-c26f3e5f79fa2caa17d18be41e32871ac09b1dc4.tar.gz
puppet-c26f3e5f79fa2caa17d18be41e32871ac09b1dc4.tar.xz
puppet-c26f3e5f79fa2caa17d18be41e32871ac09b1dc4.zip
Fix tests with "relative" paths on Windows
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows, which breaks many test cases. This commit adds a method to PuppetSpec::Files.make_absolute that makes the path absolute in test cases. On Unix (Puppet.features.posix?) it is a no-op. On Windows, (Puppet.features.microsoft_windows?) the drive from the current working directory is prepended. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 462a95e3d077b1915a919399b846068816c84583) Conflicts: spec/unit/parser/functions/extlookup_spec.rb
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/indirector/direct_file_server_spec.rb6
-rwxr-xr-xspec/integration/transaction_spec.rb24
-rwxr-xr-xspec/integration/type/file_spec.rb4
3 files changed, 17 insertions, 17 deletions
diff --git a/spec/integration/indirector/direct_file_server_spec.rb b/spec/integration/indirector/direct_file_server_spec.rb
index 98f0ebe17..15223374b 100755
--- a/spec/integration/indirector/direct_file_server_spec.rb
+++ b/spec/integration/indirector/direct_file_server_spec.rb
@@ -3,12 +3,14 @@ require 'spec_helper'
require 'puppet/indirector/file_content/file'
-describe Puppet::Indirector::DirectFileServer, " when interacting with the filesystem and the model" do
+describe Puppet::Indirector::DirectFileServer, " when interacting with the filesystem and the model", :fails_on_windows => true do
+ include PuppetSpec::Files
+
before do
# We just test a subclass, since it's close enough.
@terminus = Puppet::Indirector::FileContent::File.new
- @filepath = "/path/to/my/file"
+ @filepath = make_absolute("/path/to/my/file")
end
it "should return an instance of the model" do
diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb
index 00e9dbb8e..b4214214e 100755
--- a/spec/integration/transaction_spec.rb
+++ b/spec/integration/transaction_spec.rb
@@ -1,9 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-require 'puppet_spec/files'
require 'puppet/transaction'
-require 'puppet_spec/files'
describe Puppet::Transaction do
include PuppetSpec::Files
@@ -20,10 +18,10 @@ describe Puppet::Transaction do
it "should not apply generated resources if the parent resource fails" do
catalog = Puppet::Resource::Catalog.new
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
catalog.add_resource resource
- child_resource = Puppet::Type.type(:file).new :path => "/foo/bar/baz", :backup => false
+ child_resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar/baz"), :backup => false
resource.expects(:eval_generate).returns([child_resource])
@@ -39,7 +37,7 @@ describe Puppet::Transaction do
it "should not apply virtual resources" do
catalog = Puppet::Resource::Catalog.new
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
resource.virtual = true
catalog.add_resource resource
@@ -63,7 +61,7 @@ describe Puppet::Transaction do
it "should not apply virtual exported resources" do
catalog = Puppet::Resource::Catalog.new
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
resource.exported = true
resource.virtual = true
catalog.add_resource resource
@@ -91,7 +89,7 @@ describe Puppet::Transaction do
it "should not apply host resources on device" do
catalog = Puppet::Resource::Catalog.new
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
catalog.add_resource resource
transaction = Puppet::Transaction.new(catalog)
@@ -133,7 +131,7 @@ describe Puppet::Transaction do
# Verify that one component requiring another causes the contained
# resources in the requiring component to get refreshed.
- it "should propagate events from a contained resource through its container to its dependent container's contained resources" do
+ it "should propagate events from a contained resource through its container to its dependent container's contained resources", :fails_on_windows => true do
transaction = nil
file = Puppet::Type.type(:file).new :path => tmpfile("event_propagation"), :ensure => :present
execfile = File.join(tmpdir("exec_event"), "exectestingness2")
@@ -157,7 +155,7 @@ describe Puppet::Transaction do
end
# Make sure that multiple subscriptions get triggered.
- it "should propagate events to all dependent resources" do
+ it "should propagate events to all dependent resources", :fails_on_windows => true do
path = tmpfile("path")
file1 = tmpfile("file1")
file2 = tmpfile("file2")
@@ -187,7 +185,7 @@ describe Puppet::Transaction do
FileTest.should be_exist(file2)
end
- it "should not let one failed refresh result in other refreshes failing" do
+ it "should not let one failed refresh result in other refreshes failing", :fails_on_windows => true do
path = tmpfile("path")
newfile = tmpfile("file")
file = Puppet::Type.type(:file).new(
@@ -220,7 +218,7 @@ describe Puppet::Transaction do
FileTest.should be_exists(newfile)
end
- it "should still trigger skipped resources", :'fails_on_ruby_1.9.2' => true do
+ it "should still trigger skipped resources", :'fails_on_ruby_1.9.2' => true, :fails_on_windows => true do
catalog = mk_catalog
catalog.add_resource(*Puppet::Type.type(:schedule).mkdefaultschedules)
@@ -272,7 +270,7 @@ describe Puppet::Transaction do
FileTest.should be_exists(fname)
end
- it "should not attempt to evaluate resources with failed dependencies" do
+ it "should not attempt to evaluate resources with failed dependencies", :fails_on_windows => true do
exec = Puppet::Type.type(:exec).new(
:command => "/bin/mkdir /this/path/cannot/possibly/exist",
@@ -300,7 +298,7 @@ describe Puppet::Transaction do
FileTest.should_not be_exists(file2[:path])
end
- it "should not trigger subscribing resources on failure" do
+ it "should not trigger subscribing resources on failure", :fails_on_windows => true do
file1 = tmpfile("file1")
file2 = tmpfile("file2")
diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb
index 4bed8c6c1..1a328b0b2 100755
--- a/spec/integration/type/file_spec.rb
+++ b/spec/integration/type/file_spec.rb
@@ -12,7 +12,7 @@ describe Puppet::Type.type(:file) do
end
it "should not attempt to manage files that do not exist if no means of creating the file is specified" do
- file = Puppet::Type.type(:file).new :path => "/my/file", :mode => "755"
+ file = Puppet::Type.type(:file).new :path => make_absolute("/my/file"), :mode => "755"
catalog = Puppet::Resource::Catalog.new
catalog.add_resource file
@@ -442,7 +442,7 @@ describe Puppet::Type.type(:file) do
file = Puppet::Type.type(:file).new(
- :name => dest,
+ :name => make_absolute(dest),
:ensure => :absent,
:source => source,
:backup => false