diff options
author | Nick Lewis <nick@puppetlabs.com> | 2011-08-24 15:42:03 -0700 |
---|---|---|
committer | Nick Lewis <nick@puppetlabs.com> | 2011-08-24 15:42:03 -0700 |
commit | da4a2def42639817c4522fc0162bd691956998da (patch) | |
tree | 3cb423a7d2a7a803a922b710c661d675d11bf131 /spec | |
parent | 0d51dc9be0bc1c785d749b8b352a1e43b1b6e9c6 (diff) | |
parent | 630ec36089e2224fba99b76d76eaf904af13e4d6 (diff) | |
download | puppet-da4a2def42639817c4522fc0162bd691956998da.tar.gz puppet-da4a2def42639817c4522fc0162bd691956998da.tar.xz puppet-da4a2def42639817c4522fc0162bd691956998da.zip |
Merge branch '2.7.x'
Conflicts:
lib/puppet/feature/base.rb
lib/puppet/file_serving/configuration.rb
spec/unit/indirector/ssl_file_spec.rb
spec/unit/parser/functions/extlookup_spec.rb
spec/unit/resource/catalog_spec.rb
test/language/ast/variable.rb
Diffstat (limited to 'spec')
60 files changed, 134 insertions, 230 deletions
diff --git a/spec/integration/file_serving/content_spec.rb b/spec/integration/file_serving/content_spec.rb index e82b726fe..e2efecfa4 100755 --- a/spec/integration/file_serving/content_spec.rb +++ b/spec/integration/file_serving/content_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/file_serving/content' diff --git a/spec/integration/file_serving/metadata_spec.rb b/spec/integration/file_serving/metadata_spec.rb index 8b4d53d6b..d9aaa37f5 100755 --- a/spec/integration/file_serving/metadata_spec.rb +++ b/spec/integration/file_serving/metadata_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/file_serving/metadata' diff --git a/spec/integration/indirector/direct_file_server_spec.rb b/spec/integration/indirector/direct_file_server_spec.rb index 68ed00740..79afe7569 100755 --- a/spec/integration/indirector/direct_file_server_spec.rb +++ b/spec/integration/indirector/direct_file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-19. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_content/file' diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 86b75006a..3be32754f 100755 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_content/file_server' diff --git a/spec/integration/indirector/file_metadata/file_server_spec.rb b/spec/integration/indirector/file_metadata/file_server_spec.rb index 5259837fc..2e7c54b70 100755 --- a/spec/integration/indirector/file_metadata/file_server_spec.rb +++ b/spec/integration/indirector/file_metadata/file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_metadata/file_server' diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index 4ec4bc821..78bdabce1 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-4-8. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' describe Puppet::Node::Facts do diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index b81a1fdc3..5abb880a3 100755 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-23. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/node' diff --git a/spec/integration/reports_spec.rb b/spec/integration/reports_spec.rb index d5a08d28a..17662c810 100755 --- a/spec/integration/reports_spec.rb +++ b/spec/integration/reports_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-12. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/reports' diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index ae15ee453..df310b184 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-4-8. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' describe Puppet::Resource::Catalog do diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb index dc8af6a7b..a4792449e 100755 --- a/spec/integration/ssl/certificate_authority_spec.rb +++ b/spec/integration/ssl/certificate_authority_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-4-17. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' require 'puppet/ssl/certificate_authority' diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index 6c1c8b964..bcfcd2b43 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-4-17. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' require 'puppet/ssl/certificate_request' diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb b/spec/integration/ssl/certificate_revocation_list_spec.rb index d140fd950..5912e4b98 100755 --- a/spec/integration/ssl/certificate_revocation_list_spec.rb +++ b/spec/integration/ssl/certificate_revocation_list_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-5-5. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' require 'puppet/ssl/certificate_revocation_list' diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index 94e245554..55484ad1d 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-4-17. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' require 'puppet/ssl/host' diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index 315c0c099..8c581cc04 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-4-8. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' describe Puppet::Transaction::Report do diff --git a/spec/shared_behaviours/file_server_terminus.rb b/spec/shared_behaviours/file_server_terminus.rb index 88ed47ebb..33037e551 100755 --- a/spec/shared_behaviours/file_server_terminus.rb +++ b/spec/shared_behaviours/file_server_terminus.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - shared_examples_for "Puppet::Indirector::FileServerTerminus" do # This only works if the shared behaviour is included before # the 'before' block in the including context. diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb index 3afab5b59..f5a59f5cd 100755 --- a/spec/shared_behaviours/file_serving.rb +++ b/spec/shared_behaviours/file_serving.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - shared_examples_for "Puppet::FileServing::Files" do it "should use the rest terminus when the 'puppet' URI scheme is used and a host name is present" do uri = "puppet://myhost/fakemod/my/file" diff --git a/spec/shared_behaviours/memory_terminus.rb b/spec/shared_behaviours/memory_terminus.rb index f9325a969..0d9017100 100755 --- a/spec/shared_behaviours/memory_terminus.rb +++ b/spec/shared_behaviours/memory_terminus.rb @@ -1,7 +1,3 @@ -# -# Created by Luke Kanies on 2008-4-8. -# Copyright (c) 2008. All rights reserved. - shared_examples_for "A Memory Terminus" do it "should find no instances by default" do @searcher.find(@request).should be_nil diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index bfa44f61c..d955868a0 100755 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-12. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/agent' diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 588f1659b..c20c89e03 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-12. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/configurer' diff --git a/spec/unit/file_serving/indirection_hooks_spec.rb b/spec/unit/file_serving/indirection_hooks_spec.rb index 4890505ab..526c49e0f 100755 --- a/spec/unit/file_serving/indirection_hooks_spec.rb +++ b/spec/unit/file_serving/indirection_hooks_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/file_serving/indirection_hooks' diff --git a/spec/unit/file_serving/terminus_helper_spec.rb b/spec/unit/file_serving/terminus_helper_spec.rb index 7efe3fb98..9fd27d9dc 100755 --- a/spec/unit/file_serving/terminus_helper_spec.rb +++ b/spec/unit/file_serving/terminus_helper_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-22. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/file_serving/terminus_helper' diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index cd84031e5..ea0e98e80 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-23. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/catalog/compiler' diff --git a/spec/unit/indirector/certificate/ca_spec.rb b/spec/unit/indirector/certificate/ca_spec.rb index 277d2209d..25bd4dcbf 100755 --- a/spec/unit/indirector/certificate/ca_spec.rb +++ b/spec/unit/indirector/certificate/ca_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/certificate/ca' diff --git a/spec/unit/indirector/certificate/file_spec.rb b/spec/unit/indirector/certificate/file_spec.rb index f398e1115..67b83589e 100755 --- a/spec/unit/indirector/certificate/file_spec.rb +++ b/spec/unit/indirector/certificate/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/certificate/file' diff --git a/spec/unit/indirector/certificate_request/ca_spec.rb b/spec/unit/indirector/certificate_request/ca_spec.rb index 36628df9d..9c74f09d1 100755 --- a/spec/unit/indirector/certificate_request/ca_spec.rb +++ b/spec/unit/indirector/certificate_request/ca_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/ssl/host' diff --git a/spec/unit/indirector/certificate_request/file_spec.rb b/spec/unit/indirector/certificate_request/file_spec.rb index 69dc5eb9c..654cd23f8 100755 --- a/spec/unit/indirector/certificate_request/file_spec.rb +++ b/spec/unit/indirector/certificate_request/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/certificate_request/file' diff --git a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb index d76373b97..005b5aa1d 100755 --- a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/certificate_revocation_list/ca' diff --git a/spec/unit/indirector/certificate_revocation_list/file_spec.rb b/spec/unit/indirector/certificate_revocation_list/file_spec.rb index f4b8c36d3..380290079 100755 --- a/spec/unit/indirector/certificate_revocation_list/file_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/certificate_revocation_list/file' diff --git a/spec/unit/indirector/direct_file_server_spec.rb b/spec/unit/indirector/direct_file_server_spec.rb index abd7172b7..87380438a 100755 --- a/spec/unit/indirector/direct_file_server_spec.rb +++ b/spec/unit/indirector/direct_file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-24. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/direct_file_server' diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 9f5a0249b..3b1574e52 100755 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-23. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/facts/facter' diff --git a/spec/unit/indirector/file_content/file_server_spec.rb b/spec/unit/indirector/file_content/file_server_spec.rb index 99a535dc3..6b09216d7 100755 --- a/spec/unit/indirector/file_content/file_server_spec.rb +++ b/spec/unit/indirector/file_content/file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_content/file_server' diff --git a/spec/unit/indirector/file_content/file_spec.rb b/spec/unit/indirector/file_content/file_spec.rb index b629981c5..d1c6dc738 100755 --- a/spec/unit/indirector/file_content/file_spec.rb +++ b/spec/unit/indirector/file_content/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_content/file' diff --git a/spec/unit/indirector/file_metadata/file_server_spec.rb b/spec/unit/indirector/file_metadata/file_server_spec.rb index e16829035..14177d702 100755 --- a/spec/unit/indirector/file_metadata/file_server_spec.rb +++ b/spec/unit/indirector/file_metadata/file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_metadata/file_server' diff --git a/spec/unit/indirector/file_metadata/file_spec.rb b/spec/unit/indirector/file_metadata/file_spec.rb index 28a974290..9df53384b 100755 --- a/spec/unit/indirector/file_metadata/file_spec.rb +++ b/spec/unit/indirector/file_metadata/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_metadata/file' diff --git a/spec/unit/indirector/file_server_spec.rb b/spec/unit/indirector/file_server_spec.rb index 96fe101d5..8f7a5d1b3 100755 --- a/spec/unit/indirector/file_server_spec.rb +++ b/spec/unit/indirector/file_server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-10-19. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/file_server' diff --git a/spec/unit/indirector/key/ca_spec.rb b/spec/unit/indirector/key/ca_spec.rb index ba3d1aae2..990adc975 100755 --- a/spec/unit/indirector/key/ca_spec.rb +++ b/spec/unit/indirector/key/ca_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/key/ca' diff --git a/spec/unit/indirector/key/file_spec.rb b/spec/unit/indirector/key/file_spec.rb index bf9b293d8..f9abb958f 100755 --- a/spec/unit/indirector/key/file_spec.rb +++ b/spec/unit/indirector/key/file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-7. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/key/file' diff --git a/spec/unit/indirector/report/processor_spec.rb b/spec/unit/indirector/report/processor_spec.rb index c64cc7eff..6184cb9b5 100755 --- a/spec/unit/indirector/report/processor_spec.rb +++ b/spec/unit/indirector/report/processor_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-23. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/report/processor' diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb index 1a837f646..8ee19c8c8 100755 --- a/spec/unit/indirector/ssl_file_spec.rb +++ b/spec/unit/indirector/ssl_file_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-10. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/indirector/ssl_file' @@ -23,7 +19,7 @@ describe Puppet::Indirector::SslFile do @setting = :certdir @file_class.store_in @setting - @path = make_absolute("/tmp/my_directory") + @path = make_absolute("/thisdoesntexist/my_directory") Puppet[:noop] = false Puppet[@setting] = @path Puppet[:trace] = false @@ -47,7 +43,9 @@ describe Puppet::Indirector::SslFile do it "should fail if no store directory or file location has been set" do @file_class.store_in nil @file_class.store_at nil - lambda { @file_class.new }.should raise_error(Puppet::DevError) + FileTest.expects(:exists?).with(File.dirname(@path)).at_least(0).returns(true) + Dir.stubs(:mkdir).with(@path) + lambda { @file_class.new }.should raise_error(Puppet::DevError, /No file or directory setting provided/) end describe "when managing ssl files" do diff --git a/spec/unit/network/http/mongrel_spec.rb b/spec/unit/network/http/mongrel_spec.rb index 6776fad61..9e7e9c485 100755 --- a/spec/unit/network/http/mongrel_spec.rb +++ b/spec/unit/network/http/mongrel_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Rick Bradley on 2007-10-15. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/network/http' diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb index 8504b02e3..f84e78e24 100755 --- a/spec/unit/network/http/webrick_spec.rb +++ b/spec/unit/network/http/webrick_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Rick Bradley on 2007-10-15. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/network/handler' require 'puppet/network/http' diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index 1961f3029..c86f7a660 100755 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-26. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/network/http_pool' diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb index 550c15bf7..3f807a50b 100755 --- a/spec/unit/network/http_spec.rb +++ b/spec/unit/network/http_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Rick Bradley on 2007-10-03. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/network/http' diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb index 912275a20..b38e82b93 100755 --- a/spec/unit/network/server_spec.rb +++ b/spec/unit/network/server_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Rick Bradley on 2007-10-03. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/network/server' require 'puppet/network/handler' diff --git a/spec/unit/provider/group/ldap_spec.rb b/spec/unit/provider/group/ldap_spec.rb index 947007f10..28a57e0ee 100755 --- a/spec/unit/provider/group/ldap_spec.rb +++ b/spec/unit/provider/group/ldap_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-10. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' provider_class = Puppet::Type.type(:group).provider(:ldap) diff --git a/spec/unit/provider/ldap_spec.rb b/spec/unit/provider/ldap_spec.rb index 012a22b99..913e81fb9 100755 --- a/spec/unit/provider/ldap_spec.rb +++ b/spec/unit/provider/ldap_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-21. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'puppet/provider/ldap' diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index fdee2efab..c86525707 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-12. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'shared_behaviours/all_parsedfile_providers' diff --git a/spec/unit/provider/user/ldap_spec.rb b/spec/unit/provider/user/ldap_spec.rb index 065b3b423..8888d85ed 100755 --- a/spec/unit/provider/user/ldap_spec.rb +++ b/spec/unit/provider/user/ldap_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-10. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' provider_class = Puppet::Type.type(:user).provider(:ldap) diff --git a/spec/unit/relationship_spec.rb b/spec/unit/relationship_spec.rb index a7e787b46..1a748beff 100755 --- a/spec/unit/relationship_spec.rb +++ b/spec/unit/relationship_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-1. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'puppet/relationship' diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 17e382fcc..8a39c782c 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-1. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'puppet/simple_graph' diff --git a/spec/unit/util/checksums_spec.rb b/spec/unit/util/checksums_spec.rb index 146544201..f8800b512 100755 --- a/spec/unit/util/checksums_spec.rb +++ b/spec/unit/util/checksums_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-9-22. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/util/checksums' diff --git a/spec/unit/util/constant_inflector_spec.rb b/spec/unit/util/constant_inflector_spec.rb index cf2e8f892..88c1d9aa3 100755 --- a/spec/unit/util/constant_inflector_spec.rb +++ b/spec/unit/util/constant_inflector_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-02-12. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/util/constant_inflector' diff --git a/spec/unit/util/ldap/connection_spec.rb b/spec/unit/util/ldap/connection_spec.rb index f97c72d77..f02ea10cb 100755 --- a/spec/unit/util/ldap/connection_spec.rb +++ b/spec/unit/util/ldap/connection_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-19. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'puppet/util/ldap/connection' diff --git a/spec/unit/util/ldap/generator_spec.rb b/spec/unit/util/ldap/generator_spec.rb index b3e664d6b..51285e233 100755 --- a/spec/unit/util/ldap/generator_spec.rb +++ b/spec/unit/util/ldap/generator_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-28. -# Copyright (c) 2008. All rights reserved. - require 'spec_helper' require 'puppet/util/ldap/generator' diff --git a/spec/unit/util/ldap/manager_spec.rb b/spec/unit/util/ldap/manager_spec.rb index 5cce626b5..16c6b0601 100755 --- a/spec/unit/util/ldap/manager_spec.rb +++ b/spec/unit/util/ldap/manager_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-3-19. -# Copyright (c) 2006. All rights reserved. - require 'spec_helper' require 'puppet/util/ldap/manager' diff --git a/spec/unit/util/nagios_maker_spec.rb b/spec/unit/util/nagios_maker_spec.rb index b61f4fe9d..9cd038ff3 100755 --- a/spec/unit/util/nagios_maker_spec.rb +++ b/spec/unit/util/nagios_maker_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2007-11-18. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/util/nagios_maker' diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb index 01d891f08..6344cf1b5 100755 --- a/spec/unit/util/settings/file_setting_spec.rb +++ b/spec/unit/util/settings/file_setting_spec.rb @@ -189,6 +189,8 @@ describe Puppet::Util::Settings::FileSetting do it "should set the owner if running as root and the owner is provided" do Puppet.features.expects(:root?).returns true + Puppet.features.stubs(:microsoft_windows?).returns false + @file.stubs(:owner).returns "foo" @file.to_resource[:owner].should == "foo" end @@ -203,6 +205,8 @@ describe Puppet::Util::Settings::FileSetting do it "should set the group if running as root and the group is provided" do Puppet.features.expects(:root?).returns true + Puppet.features.stubs(:microsoft_windows?).returns false + @file.stubs(:group).returns "foo" @file.to_resource[:group].should == "foo" end @@ -218,16 +222,34 @@ describe Puppet::Util::Settings::FileSetting do it "should not set owner if not running as root" do Puppet.features.expects(:root?).returns false + Puppet.features.stubs(:microsoft_windows?).returns false @file.stubs(:owner).returns "foo" @file.to_resource[:owner].should be_nil end it "should not set group if not running as root" do Puppet.features.expects(:root?).returns false + Puppet.features.stubs(:microsoft_windows?).returns false @file.stubs(:group).returns "foo" @file.to_resource[:group].should be_nil end + describe "on Microsoft Windows systems" do + before :each do + Puppet.features.stubs(:microsoft_windows?).returns true + end + + it "should not set owner" do + @file.stubs(:owner).returns "foo" + @file.to_resource[:owner].should be_nil + end + + it "should not set group" do + @file.stubs(:group).returns "foo" + @file.to_resource[:group].should be_nil + end + end + it "should set :ensure to the file type" do @file.expects(:type).returns :directory @file.to_resource[:ensure].should == :directory diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb index 76f229c0f..69c117f28 100755 --- a/spec/unit/util/settings_spec.rb +++ b/spec/unit/util/settings_spec.rb @@ -720,9 +720,28 @@ describe Puppet::Util::Settings do @settings.to_catalog end + describe "on Microsoft Windows" do + before :each do + Puppet.features.stubs(:root?).returns true + Puppet.features.stubs(:microsoft_windows?).returns true + + @settings.setdefaults :foo, :mkusers => [true, "e"], :user => ["suser", "doc"], :group => ["sgroup", "doc"] + @settings.setdefaults :other, :otherdir => {:default => "/otherdir", :desc => "a", :owner => "service", :group => "service"} + + @catalog = @settings.to_catalog + end + + it "it should not add users and groups to the catalog" do + @catalog.resource(:user, "suser").should be_nil + @catalog.resource(:group, "sgroup").should be_nil + end + end + describe "when adding users and groups to the catalog" do before do Puppet.features.stubs(:root?).returns true + Puppet.features.stubs(:microsoft_windows?).returns false + @settings.setdefaults :foo, :mkusers => [true, "e"], :user => ["suser", "doc"], :group => ["sgroup", "doc"] @settings.setdefaults :other, :otherdir => {:default => "/otherdir", :desc => "a", :owner => "service", :group => "service"} diff --git a/spec/unit/util/suidmanager_spec.rb b/spec/unit/util/suidmanager_spec.rb index abfe3f723..474d0b2a2 100755 --- a/spec/unit/util/suidmanager_spec.rb +++ b/spec/unit/util/suidmanager_spec.rb @@ -66,6 +66,14 @@ describe Puppet::Util::SUIDManager do xids.should be_empty end + + it "should not get or set euid/egid on Windows" do + Puppet.features.stubs(:microsoft_windows?).returns true + + Puppet::Util::SUIDManager.asuser(user[:uid], user[:gid]) {} + + xids.should be_empty + end end describe "#change_group" do @@ -195,6 +203,15 @@ describe Puppet::Util::SUIDManager do xids.should be_empty end + + it "should not get or set euid/egid on Windows" do + Puppet.features.stubs(:microsoft_windows?).returns true + Kernel.expects(:system).with('blah') + + Puppet::Util::SUIDManager.system('blah', user[:uid], user[:gid]) + + xids.should be_empty + end end describe "with #run_and_capture" do @@ -210,4 +227,76 @@ describe Puppet::Util::SUIDManager do end end end + + describe "#root?" do + describe "on POSIX systems" do + before :each do + Puppet.features.stubs(:posix?).returns(true) + Puppet.features.stubs(:microsoft_windows?).returns(false) + end + + it "should be root if uid is 0" do + Process.stubs(:uid).returns(0) + + Puppet::Util::SUIDManager.should be_root + end + + it "should not be root if uid is not 0" do + Process.stubs(:uid).returns(1) + + Puppet::Util::SUIDManager.should_not be_root + end + end + + describe "on Microsoft Windows", :if => Puppet.features.microsoft_windows? do + describe "2003 without UAC" do + it "should be root if user is a member of the Administrators group" do + Win32::Security.stubs(:elevated_security?).raises(Win32::Security::Error, "Incorrect function.") + Sys::Admin.stubs(:get_login).returns("Administrator") + Sys::Group.stubs(:members).returns(%w[Administrator]) + + Puppet::Util::SUIDManager.should be_root + end + + it "should not be root if the process is running as Guest" do + Win32::Security.stubs(:elevated_security?).raises(Win32::Security::Error, "Incorrect function.") + Sys::Admin.stubs(:get_login).returns("Guest") + Sys::Group.stubs(:members).returns([]) + + Puppet::Util::SUIDManager.should_not be_root + end + + it "should raise an exception if the process fails to open the process token" do + Win32::Security.stubs(:elevated_security?).raises(Win32::Security::Error, "Access denied.") + Sys::Admin.stubs(:get_login).returns("Administrator") + Sys::Group.expects(:members).never + + lambda { Puppet::Util::SUIDManager.should raise_error(Win32::Security::Error, /Access denied./) } + end + end + + describe "2008 with UAC" do + it "should be root if user is running with elevated privileges" do + Win32::Security.stubs(:elevated_security?).returns(true) + Sys::Admin.expects(:get_login).never + + Puppet::Util::SUIDManager.should be_root + end + + it "should not be root if user is not running with elevated privileges" do + Win32::Security.stubs(:elevated_security?).returns(false) + Sys::Admin.expects(:get_login).never + + Puppet::Util::SUIDManager.should_not be_root + end + + it "should raise an exception if the process fails to open the process token" do + Win32::Security.stubs(:elevated_security?).raises(Win32::Security::Error, "Access denied.") + Sys::Admin.expects(:get_login).never + + lambda { Puppet::Util::SUIDManager.should raise_error(Win32::Security::Error, /Access denied./) } + end + end + end + end end diff --git a/spec/unit/util/tagging_spec.rb b/spec/unit/util/tagging_spec.rb index 018871bef..1e5abdadd 100755 --- a/spec/unit/util/tagging_spec.rb +++ b/spec/unit/util/tagging_spec.rb @@ -1,8 +1,4 @@ #!/usr/bin/env rspec -# -# Created by Luke Kanies on 2008-01-19. -# Copyright (c) 2007. All rights reserved. - require 'spec_helper' require 'puppet/util/tagging' |