diff options
| author | Dominic Maraglia <dominic@puppetlabs.com> | 2011-08-03 15:43:20 -0700 |
|---|---|---|
| committer | Dominic Maraglia <dominic@puppetlabs.com> | 2011-08-03 15:43:20 -0700 |
| commit | e45f08bf1fef8842554ca0d8cb6fb13711e888e7 (patch) | |
| tree | 9bb476a0fe381d53060abc1f1c240cf1291b2ee4 /spec/integration | |
| parent | a97c86e7d01384aa06f5d4d69da427fc355aebe7 (diff) | |
| parent | c833fde370d43023f52c8f2e11fd77e720d0f577 (diff) | |
Merge branch 'master' of github.com:puppetlabs/puppet
Diffstat (limited to 'spec/integration')
25 files changed, 238 insertions, 104 deletions
diff --git a/spec/integration/application/doc_spec.rb b/spec/integration/application/doc_spec.rb index 9412976f0..2cf5fd1e9 100755 --- a/spec/integration/application/doc_spec.rb +++ b/spec/integration/application/doc_spec.rb @@ -5,7 +5,7 @@ require 'puppet_spec/files' describe Puppet::Application::Doc do include PuppetSpec::Files - it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true do + it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true, :unless => Puppet.features.microsoft_windows? do begin # Note: the directory structure below is more complex than it # needs to be, but it's representative of the directory structure diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index 9bec769ab..84297e8f9 100755 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -275,6 +275,16 @@ describe "Puppet defaults" do describe "reporturl" do subject { Puppet.settings[:reporturl] } - it { should == "http://localhost:3000/reports" } + it { should == "http://localhost:3000/reports/upload" } + end + + describe "when configuring color" do + it "should default to ansi", :unless => Puppet.features.microsoft_windows? do + Puppet.settings[:color].should == 'ansi' + end + + it "should default to false", :if => Puppet.features.microsoft_windows? do + Puppet.settings[:color].should == 'false' + end end end diff --git a/spec/integration/file_serving/content_spec.rb b/spec/integration/file_serving/content_spec.rb index a95ddc520..e82b726fe 100755 --- a/spec/integration/file_serving/content_spec.rb +++ b/spec/integration/file_serving/content_spec.rb @@ -15,6 +15,4 @@ describe Puppet::FileServing::Content, " when finding files" do @test_class = Puppet::FileServing::Content @indirection = Puppet::FileServing::Content.indirection end - - after { Puppet::Util::Cacher.expire } end diff --git a/spec/integration/file_serving/metadata_spec.rb b/spec/integration/file_serving/metadata_spec.rb index ba7d3311f..8b4d53d6b 100755 --- a/spec/integration/file_serving/metadata_spec.rb +++ b/spec/integration/file_serving/metadata_spec.rb @@ -16,6 +16,4 @@ describe Puppet::FileServing::Metadata, " when finding files" do @test_class = Puppet::FileServing::Metadata @indirection = Puppet::FileServing::Metadata.indirection end - - after { Puppet::Util::Cacher.expire } end diff --git a/spec/integration/file_serving/terminus_helper_spec.rb b/spec/integration/file_serving/terminus_helper_spec.rb index 7500b1fc0..99fee9ce5 100755 --- a/spec/integration/file_serving/terminus_helper_spec.rb +++ b/spec/integration/file_serving/terminus_helper_spec.rb @@ -10,7 +10,7 @@ class TerminusHelperIntegrationTester end end -describe Puppet::FileServing::TerminusHelper do +describe Puppet::FileServing::TerminusHelper, :fails_on_windows => true do it "should be able to recurse on a single file" do @path = Tempfile.new("fileset_integration") request = Puppet::Indirector::Request.new(:metadata, :find, @path.path, :recurse => true) diff --git a/spec/integration/indirector/direct_file_server_spec.rb b/spec/integration/indirector/direct_file_server_spec.rb index e53b48d69..68ed00740 100755 --- a/spec/integration/indirector/direct_file_server_spec.rb +++ b/spec/integration/indirector/direct_file_server_spec.rb @@ -7,12 +7,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 @@ -32,7 +34,7 @@ describe Puppet::Indirector::DirectFileServer, " when interacting with the files end end -describe Puppet::Indirector::DirectFileServer, " when interacting with FileServing::Fileset and the model" do +describe Puppet::Indirector::DirectFileServer, " when interacting with FileServing::Fileset and the model", :fails_on_windows => true do before do @terminus = Puppet::Indirector::FileContent::File.new diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 88d2345d8..86b75006a 100755 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -10,13 +10,14 @@ require 'shared_behaviours/file_server_terminus' require 'puppet_spec/files' -describe Puppet::Indirector::FileContent::FileServer, " when finding files" do +describe Puppet::Indirector::FileContent::FileServer, " when finding files", :fails_on_windows => true do it_should_behave_like "Puppet::Indirector::FileServerTerminus" include PuppetSpec::Files before do @terminus = Puppet::Indirector::FileContent::FileServer.new @test_class = Puppet::FileServing::Content + Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil) end it "should find plugin file content in the environment specified in the request" do @@ -62,7 +63,6 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do end it "should find file content in files when node name expansions are used" do - Puppet::Util::Cacher.expire FileTest.stubs(:exists?).returns true FileTest.stubs(:exists?).with(Puppet[:fileserverconfig]).returns(true) diff --git a/spec/integration/indirector/file_metadata/file_server_spec.rb b/spec/integration/indirector/file_metadata/file_server_spec.rb index 9e84134a6..5259837fc 100755 --- a/spec/integration/indirector/file_metadata/file_server_spec.rb +++ b/spec/integration/indirector/file_metadata/file_server_spec.rb @@ -8,7 +8,7 @@ require 'spec_helper' require 'puppet/indirector/file_metadata/file_server' require 'shared_behaviours/file_server_terminus' -describe Puppet::Indirector::FileMetadata::FileServer, " when finding files" do +describe Puppet::Indirector::FileMetadata::FileServer, " when finding files", :fails_on_windows => true do it_should_behave_like "Puppet::Indirector::FileServerTerminus" before do diff --git a/spec/integration/network/rest_authconfig_spec.rb b/spec/integration/network/rest_authconfig_spec.rb new file mode 100644 index 000000000..d2f539cd4 --- /dev/null +++ b/spec/integration/network/rest_authconfig_spec.rb @@ -0,0 +1,145 @@ +require 'spec_helper' + +require 'puppet/network/rest_authconfig' + +RSpec::Matchers.define :allow do |params| + + match do |auth| + begin + auth.check_authorization(params[0], params[1], params[2], params[3]) + true + rescue Puppet::Network::AuthorizationError + false + end + end + + failure_message_for_should do |instance| + "expected #{params[3][:node]}/#{params[3][:ip]} to be allowed" + end + + failure_message_for_should_not do |instance| + "expected #{params[3][:node]}/#{params[3][:ip]} to be forbidden" + end +end + +describe Puppet::Network::RestAuthConfig do + include PuppetSpec::Files + + before(:each) do + Puppet[:rest_authconfig] = tmpfile('auth.conf') + end + + def add_rule(rule) + File.open(Puppet[:rest_authconfig],"w+") do |f| + f.print "path /test\n#{rule}\n" + end + @auth = Puppet::Network::RestAuthConfig.new(Puppet[:rest_authconfig], true) + end + + def add_regex_rule(regex, rule) + File.open(Puppet[:rest_authconfig],"w+") do |f| + f.print "path ~ #{regex}\n#{rule}\n" + end + @auth = Puppet::Network::RestAuthConfig.new(Puppet[:rest_authconfig], true) + end + + def request(args = {}) + { :ip => '10.1.1.1', :node => 'host.domain.com', :key => 'key', :authenticated => true }.each do |k,v| + args[k] ||= v + end + ['test', :find, args[:key], args] + end + + it "should support IPv4 address" do + add_rule("allow 10.1.1.1") + + @auth.should allow(request) + end + + it "should support CIDR IPv4 address" do + add_rule("allow 10.0.0.0/8") + + @auth.should allow(request) + end + + it "should support wildcard IPv4 address" do + add_rule("allow 10.1.1.*") + + @auth.should allow(request) + end + + it "should support IPv6 address" do + add_rule("allow 2001:DB8::8:800:200C:417A") + + @auth.should allow(request(:ip => '2001:DB8::8:800:200C:417A')) + end + + it "should support hostname" do + add_rule("allow host.domain.com") + + @auth.should allow(request) + end + + it "should support wildcard host" do + add_rule("allow *.domain.com") + + @auth.should allow(request) + end + + it "should support hostname backreferences" do + add_regex_rule('^/test/([^/]+)$', "allow $1.domain.com") + + @auth.should allow(request(:key => 'host')) + end + + it "should support opaque strings" do + add_rule("allow this-is-opaque@or-not") + + @auth.should allow(request(:node => 'this-is-opaque@or-not')) + end + + it "should support opaque strings and backreferences" do + add_regex_rule('^/test/([^/]+)$', "allow $1") + + @auth.should allow(request(:key => 'this-is-opaque@or-not', :node => 'this-is-opaque@or-not')) + end + + it "should support hostname ending with '.'" do + pending('bug #7589') + add_rule("allow host.domain.com.") + + @auth.should allow(request(:node => 'host.domain.com.')) + end + + it "should support hostname ending with '.' and backreferences" do + pending('bug #7589') + add_regex_rule('^/test/([^/]+)$',"allow $1") + + @auth.should allow(request(:node => 'host.domain.com.')) + end + + it "should support trailing whitespace" do + add_rule('allow host.domain.com ') + + @auth.should allow(request) + end + + it "should support inlined comments" do + add_rule('allow host.domain.com # will it work?') + + @auth.should allow(request) + end + + it "should deny non-matching host" do + add_rule("allow inexistant") + + @auth.should_not allow(request) + end + + it "should deny denied hosts" do + add_rule("deny host.domain.com") + + @auth.should_not allow(request) + end + +end
\ No newline at end of file diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 81c35af4f..7365462d3 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -4,7 +4,9 @@ require 'puppet/network/server' require 'puppet/ssl/certificate_authority' require 'socket' -describe Puppet::Network::Server do +describe Puppet::Network::Server, :unless => Puppet.features.microsoft_windows? do + include PuppetSpec::Files + describe "when using webrick" do before :each do Puppet[:servertype] = 'webrick' @@ -12,11 +14,10 @@ describe Puppet::Network::Server do @params = { :port => 34343, :handlers => [ :node ], :xmlrpc_handlers => [ :status ] } # Get a safe temporary file - @tmpfile = Tempfile.new("webrick_integration_testing") - @dir = @tmpfile.path + "_dir" + dir = tmpdir("webrick_integration_testing") - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir Puppet.settings[:group] = Process.gid Puppet::SSL::Host.ca_location = :local @@ -26,13 +27,9 @@ describe Puppet::Network::Server do end after do - @tmpfile.delete Puppet.settings.clear - system("rm -rf #{@dir}") - Puppet::SSL::Host.ca_location = :none - Puppet::Util::Cacher.expire end describe "before listening" do diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index f54d7f9aa..4ec4bc821 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -7,8 +7,6 @@ require 'spec_helper' describe Puppet::Node::Facts do describe "when using the indirector" do - after { Puppet::Util::Cacher.expire } - it "should expire any cached node instances when it is saved" do Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml diff --git a/spec/integration/parser/functions_spec.rb b/spec/integration/parser/functions_spec.rb index 6791987d7..6a8fbca9c 100755 --- a/spec/integration/parser/functions_spec.rb +++ b/spec/integration/parser/functions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Puppet::Parser::Functions do before :each do - Puppet::Parser::Functions.rmfunction("template") if Puppet::Parser::Functions.function("template") + Puppet::Parser::Functions.rmfunction("template") if Puppet::Parser::Functions.functions.include?("template") end it "should support multiple threads autoloading the same function" do diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index 4af0dca4a..b2e9c4497 100755 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' require 'puppet/file_bucket/dipper' -describe "mount provider (integration)" do +describe "mount provider (integration)", :unless => Puppet.features.microsoft_windows? do include PuppetSpec::Files def create_fake_fstab(initially_contains_entry) diff --git a/spec/integration/provider/package_spec.rb b/spec/integration/provider/package_spec.rb index 5fecdf13c..701752371 100755 --- a/spec/integration/provider/package_spec.rb +++ b/spec/integration/provider/package_spec.rb @@ -12,7 +12,7 @@ describe "Package Provider", :'fails_on_ruby_1.9.2' => true do lambda { pkg.provider.install }.should raise_error end - it "should be able to get a list of existing packages" do + it "should be able to get a list of existing packages", :fails_on_windows => true do provider.instances.each do |package| package.should be_instance_of(provider) package.properties[:provider].should == provider.name diff --git a/spec/integration/provider/ssh_authorized_key_spec.rb b/spec/integration/provider/ssh_authorized_key_spec.rb index 902f9ad22..252f7bf78 100644..100755 --- a/spec/integration/provider/ssh_authorized_key_spec.rb +++ b/spec/integration/provider/ssh_authorized_key_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require 'puppet/file_bucket/dipper' -describe "ssh_authorized_key provider (integration)" do +describe "ssh_authorized_key provider (integration)", :unless => Puppet.features.microsoft_windows? do include PuppetSpec::Files before :each do diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index 41a475d98..ae15ee453 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -13,7 +13,6 @@ describe Puppet::Resource::Catalog do end describe "when using the indirector" do - after { Puppet::Util::Cacher.expire } before do # This is so the tests work w/out networking. Facter.stubs(:to_hash).returns({"hostname" => "foo.domain.com"}) diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb index c5e145459..dc8af6a7b 100755 --- a/spec/integration/ssl/certificate_authority_spec.rb +++ b/spec/integration/ssl/certificate_authority_spec.rb @@ -6,17 +6,16 @@ require 'spec_helper' require 'puppet/ssl/certificate_authority' -require 'tempfile' -describe Puppet::SSL::CertificateAuthority do +describe Puppet::SSL::CertificateAuthority, :unless => Puppet.features.microsoft_windows? do + include PuppetSpec::Files + before do # Get a safe temporary file - file = Tempfile.new("ca_integration_testing") - @dir = file.path - file.delete + dir = tmpdir("ca_integration_testing") - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir Puppet.settings[:group] = Process.gid Puppet::SSL::Host.ca_location = :local @@ -26,11 +25,8 @@ describe Puppet::SSL::CertificateAuthority do after { Puppet::SSL::Host.ca_location = :none - system("rm -rf #{@dir}") Puppet.settings.clear - Puppet::Util::Cacher.expire - Puppet::SSL::CertificateAuthority.instance_variable_set("@instance", nil) } diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index 688466c37..6c1c8b964 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -6,21 +6,19 @@ require 'spec_helper' require 'puppet/ssl/certificate_request' -require 'tempfile' -describe Puppet::SSL::CertificateRequest do +# REMIND: Fails on windows because there is no user provider yet +describe Puppet::SSL::CertificateRequest, :fails_on_windows => true do + include PuppetSpec::Files + before do # Get a safe temporary file - file = Tempfile.new("csr_integration_testing") - @dir = file.path - file.delete - - Dir.mkdir(@dir) + dir = tmpdir("csr_integration_testing") Puppet.settings.clear - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir Puppet.settings[:group] = Process.gid Puppet::SSL::Host.ca_location = :none @@ -28,14 +26,13 @@ describe Puppet::SSL::CertificateRequest do @csr = Puppet::SSL::CertificateRequest.new("luke.madstop.com") @key = OpenSSL::PKey::RSA.new(512) + + # This is necessary so the terminus instances don't lie around. + Puppet::SSL::CertificateRequest.indirection.termini.clear end after do - system("rm -rf #{@dir}") Puppet.settings.clear - - # This is necessary so the terminus instances don't lie around. - Puppet::Util::Cacher.expire end it "should be able to generate CSRs" do diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb b/spec/integration/ssl/certificate_revocation_list_spec.rb index 051a81569..d140fd950 100755 --- a/spec/integration/ssl/certificate_revocation_list_spec.rb +++ b/spec/integration/ssl/certificate_revocation_list_spec.rb @@ -6,17 +6,17 @@ require 'spec_helper' require 'puppet/ssl/certificate_revocation_list' -require 'tempfile' -describe Puppet::SSL::CertificateRevocationList do +# REMIND: Fails on windows because there is no user provider yet +describe Puppet::SSL::CertificateRevocationList, :fails_on_windows => true do + include PuppetSpec::Files + before do # Get a safe temporary file - file = Tempfile.new("ca_integration_testing") - @dir = file.path - file.delete + dir = tmpdir("ca_integration_testing") - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir Puppet.settings[:group] = Process.gid Puppet::SSL::Host.ca_location = :local @@ -25,11 +25,10 @@ describe Puppet::SSL::CertificateRevocationList do after { Puppet::SSL::Host.ca_location = :none - system("rm -rf #{@dir}") Puppet.settings.clear # This is necessary so the terminus instances don't lie around. - Puppet::Util::Cacher.expire + Puppet::SSL::Host.indirection.termini.clear } it "should be able to read in written out CRLs with no revoked certificates" do diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index e9c37c151..94e245554 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -6,17 +6,17 @@ require 'spec_helper' require 'puppet/ssl/host' -require 'tempfile' -describe Puppet::SSL::Host do +# REMIND: Fails on windows because there is no user provider yet +describe Puppet::SSL::Host, :fails_on_windows => true do + include PuppetSpec::Files + before do # Get a safe temporary file - file = Tempfile.new("host_integration_testing") - @dir = file.path - file.delete + dir = tmpdir("host_integration_testing") - Puppet.settings[:confdir] = @dir - Puppet.settings[:vardir] = @dir + Puppet.settings[:confdir] = dir + Puppet.settings[:vardir] = dir Puppet.settings[:group] = Process.gid Puppet::SSL::Host.ca_location = :local @@ -28,9 +28,7 @@ describe Puppet::SSL::Host do after { Puppet::SSL::Host.ca_location = :none - system("rm -rf #{@dir}") Puppet.settings.clear - Puppet::Util::Cacher.expire } it "should be considered a CA host if its name is equal to 'ca'" do @@ -81,7 +79,7 @@ describe Puppet::SSL::Host do end end - it "should pass the verification of its own SSL store" do + it "should pass the verification of its own SSL store", :unless => Puppet.features.microsoft_windows? do @host.generate @ca = Puppet::SSL::CertificateAuthority.new @ca.sign(@host.name) diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index 183d93f76..315c0c099 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -8,7 +8,6 @@ require 'spec_helper' describe Puppet::Transaction::Report do describe "when using the indirector" do after do - Puppet::Util::Cacher.expire Puppet.settings.stubs(:use) end 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..9814c4539 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 @@ -23,7 +23,7 @@ describe Puppet::Type.type(:file) do end describe "when writing files" do - it "should backup files to a filebucket when one is configured" do + it "should backup files to a filebucket when one is configured", :fails_on_windows => true do bucket = Puppet::Type.type(:filebucket).new :path => tmpfile("filebucket"), :name => "mybucket" file = Puppet::Type.type(:file).new :path => tmpfile("bucket_backs"), :backup => "mybucket", :content => "foo" catalog = Puppet::Resource::Catalog.new @@ -73,7 +73,7 @@ describe Puppet::Type.type(:file) do File.read(file[:path]).should == "bar\n" end - it "should not backup symlinks" do + it "should not backup symlinks", :unless => Puppet.features.microsoft_windows? do link = tmpfile("link") dest1 = tmpfile("dest1") dest2 = tmpfile("dest2") @@ -110,7 +110,7 @@ describe Puppet::Type.type(:file) do File.read(File.join(backup, "foo")).should == "yay" end - it "should backup directories to filebuckets by backing up each file separately" do + it "should backup directories to filebuckets by backing up each file separately", :fails_on_windows => true do bucket = Puppet::Type.type(:filebucket).new :path => tmpfile("filebucket"), :name => "mybucket" file = Puppet::Type.type(:file).new :path => tmpfile("bucket_backs"), :backup => "mybucket", :content => "foo", :force => true catalog = Puppet::Resource::Catalog.new @@ -172,7 +172,7 @@ describe Puppet::Type.type(:file) do end end - it "should be able to recurse over a nonexistent file" do + it "should be able to recurse over a nonexistent file", :fails_on_windows => true do @path = tmpfile("file_integration_tests") @file = Puppet::Type::File.new( @@ -214,7 +214,7 @@ describe Puppet::Type.type(:file) do end end - it "should be able to recursively make links to other files" do + it "should be able to recursively make links to other files", :unless => Puppet.features.microsoft_windows? do source = tmpfile("file_link_integration_source") build_path(source) @@ -241,7 +241,7 @@ describe Puppet::Type.type(:file) do end end - it "should be able to recursively copy files" do + it "should be able to recursively copy files", :fails_on_windows => true do source = tmpfile("file_source_integration_source") build_path(source) @@ -292,24 +292,25 @@ describe Puppet::Type.type(:file) do it "should recursively manage files even if there is an explicit file whose name is a prefix of the managed file" do dir = tmpfile("recursion_vs_explicit_2") - managed = File.join(dir, "file") - generated = File.join(dir, "file_with_a_name_starting_with_the_word_file") + managed = File.join(dir, "file") + generated = File.join(dir, "file_with_a_name_starting_with_the_word_file") + managed_mode = Puppet.features.microsoft_windows? ? 0444 : 0700 FileUtils.mkdir_p(dir) File.open(managed, "w") { |f| f.puts "" } File.open(generated, "w") { |f| f.puts "" } @catalog = Puppet::Resource::Catalog.new - @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => "755") + @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => managed_mode) @catalog.add_resource Puppet::Type::File.new(:name => managed, :recurse => true, :backup => false, :mode => "644") @catalog.apply - (File.stat(generated).mode & 007777).should == 0755 + (File.stat(generated).mode & 007777).should == managed_mode end end - describe "when generating resources" do + describe "when generating resources", :fails_on_windows => true do before do @source = tmpfile("generating_in_catalog_source") @@ -381,8 +382,9 @@ describe Puppet::Type.type(:file) do catalog.apply + expected_mode = Puppet.features.microsoft_windows? ? 0644 : 0755 File.read(dest).should == "foo" - (File.stat(dest).mode & 007777).should == 0755 + (File.stat(dest).mode & 007777).should == expected_mode end it "should be able to copy individual files even if recurse has been specified" do @@ -442,7 +444,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 @@ -470,7 +472,6 @@ describe Puppet::Type.type(:file) do # this file should get removed File.open(@purgee, "w") { |f| f.puts "footest" } - @lfobj = Puppet::Type.newfile( :title => "localfile", :path => @localfile, @@ -479,7 +480,6 @@ describe Puppet::Type.type(:file) do :backup => false ) - @destobj = Puppet::Type.newfile( :title => "destdir", :path => @destdir, diff --git a/spec/integration/type/tidy_spec.rb b/spec/integration/type/tidy_spec.rb index 675aaf4cd..d1bb62d6e 100755 --- a/spec/integration/type/tidy_spec.rb +++ b/spec/integration/type/tidy_spec.rb @@ -12,7 +12,7 @@ describe Puppet::Type.type(:tidy) do end # Testing #355. - it "should be able to remove dead links" do + it "should be able to remove dead links", :unless => Puppet.features.microsoft_windows? do dir = tmpfile("tidy_link_testing") link = File.join(dir, "link") target = tmpfile("no_such_file_tidy_link_testing") diff --git a/spec/integration/util/settings_spec.rb b/spec/integration/util/settings_spec.rb index b05c63107..46d783c4e 100755 --- a/spec/integration/util/settings_spec.rb +++ b/spec/integration/util/settings_spec.rb @@ -18,12 +18,12 @@ describe Puppet::Util::Settings do File.should be_directory(settings[:maindir]) end - it "should make its directories with the corret modes" do + it "should make its directories with the correct modes" do settings = Puppet::Util::Settings.new settings.setdefaults :main, minimal_default_settings.update( :maindir => {:default => tmpfile("main"), :desc => "a", :mode => 0750} ) settings.use(:main) - (File.stat(settings[:maindir]).mode & 007777).should == 0750 + (File.stat(settings[:maindir]).mode & 007777).should == (Puppet.features.microsoft_windows? ? 0755 : 0750) end end |
