summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/package
Commit message (Collapse)AuthorAgeFilesLines
* maint: Fix pacman provider to work with Ruby 1.9Matt Robinson2011-05-241-3/+2
| | | | | | | | | | | | Ruby 1.9 doesn't allow the lambda to walk up the directory structure to require the spec helper This is the same issue as with commit: f6da3339f59bbd9243a03dc1e417b1fed7955c7e Also, you can't call each on a string in Ruby 1.9 directly since it doesn't implicitly do a split on \n like it did in older Rubies, but each_line works all the way back to 1.8.5 Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* Merge branch '2.7.next' into nextPieter van de Bruggen2011-05-181-3/+2
|\
| * maint: fix spec_helper inclusions again.Daniel Pittman2011-05-171-3/+2
| | | | | | | | | | | | | | | | | | | | We got rid of the '../../spec_helper' style requires, but a few of them snuck back in in recent changes. This purges them out, replaced with the header: #!/usr/bin/env rspec require 'spec_helper' Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.7.next' into nextPieter van de Bruggen2011-05-171-2/+2
|\|
| * (#7507) Add ability to filter Ruby 1.9 spec failuresMatt Robinson2011-05-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By running: rspec spec --tag ~@fails_on_ruby_1.9.2 We can now just run the specs that pass under Ruby 1.9. Obviously in the long term we want to have all the specs passing, but until then we need notification when we regress. From now on new code will be required to pass under Ruby 1.9, and Jenkins will give us email notification if it doesn't or if we break something that was already working. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* | (#1853) Pacman package providerPaul Boyd2011-05-161-0/+1
| | | | | | | | Stub the command method, so it doesn't give an error.
* | (#1853) Pacman package providerPaul Boyd2011-05-161-0/+237
|/ | | | | | | Adds support for use Archlinux's pacman package manager in Puppet. Originally written by Miah Johnson, with bug fixes from Thomas Hatch and myself.
* (#7468) Stub spec that tries to connect to pypi.python.orgMatt Robinson2011-05-101-20/+24
| | | | | | | I noticed a test failure when I ran the specs without an internet connection. Specs should never need an internet connection to pass. Reviewed-by: Max Martin <max@puppetlabs.com>
* Merge branch 'feature/master/4258-pkgutil' into 2.7.xMatt Robinson2011-04-141-0/+182
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feature/master/4258-pkgutil: (29 commits) (#4258) Fix pkgutil spec test to have the correct provider (#4258) Remove superfluous command check that called pkgutil (#4258) Fix fd leak opening pkgutil config files (#4258) Permit variations of -nv in both pkgutil.conf files (#4258) Stop file and config checks from breaking spec (#4258) Check wgetopts in pkgutil.conf (#4258) Fix hash duplication affecting canonical provider instance (#4258) Use pkgutil -a to reliably determine package common names/aliases (#4258) Update pkgutil spec for recent impl changes (#4258) pkgutil: bug fix: if shortname is not equal to package name (#4258) pkgutil provider: better handling of short package names (#4258) pkgutil provider: misc enhancements Add spec tests for pkgutil package provider * Fix exception on parse failure of pkgutil output * Fix exception when querying latest version for unknown package Fixing indentation Removing blastwave references and unused PAGER Changing indentation to 2-spaces as per 2.6+ style Single package queries made more robust when dealing with pkgutil noise Fixing wget verbose regex These regular expressions will not match anything. pkgutil doesn't output anything that can be matched. ...
| * (#4258) Fix pkgutil spec test to have the correct providerMatt Robinson2011-04-141-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The resource being used for testing didn't explicitly set the provider, so it ended up using whatever the default provider was on the system on which it was run. This was problematic when running the specs on a Mac since the default provider is pkgdmg and that provider doesn't seem to be upgradeable. So when you tried: @resource[:ensure] = :latest You got the error: 1) Puppet::Type::Package::ProviderPkgutil when installing should use a command without versioned package Failure/Error: @resource[:ensure] = :latest Puppet::Error: Parameter ensure failed: Provider must have features 'upgradeable' to set 'ensure' to 'latest' # ./lib/puppet/parameter.rb:171:in `fail' # ./lib/puppet/parameter.rb:257:in `validate' # ./lib/puppet/property.rb:300:in `should=' # ./lib/puppet/property.rb:300:in `each' # ./lib/puppet/property.rb:300:in `should=' # ./lib/puppet/property.rb:337:in `value=' # ./lib/puppet/type.rb:416:in `[]=' # ./spec/unit/provider/package/pkgutil_spec.rb:35 Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
| * (#4258) Stop file and config checks from breaking specDominic Cleal2011-04-131-0/+3
| | | | | | | | | | Moved all file and config checks into healthcheck method which is then stubbed in the spec.
| * (#4258) Use pkgutil -a to reliably determine package common names/aliasesDominic Cleal2011-03-191-6/+54
| | | | | | | | | | | | | | | | | | | | Populate instances with both the real package name ("CSWsvn") and the alias name ("subversion") from separate "pkgutil -a" call. Fixed cases where pkgutil noise was parsed as aliased package names and also breaking "not in catalog" detection. Updated pkgutil_spec test to show various edge cases.
| * (#4258) Update pkgutil spec for recent impl changesDominic Cleal2011-03-181-13/+9
| | | | | | | | | | Fix test output of pkgutil for commands using --single Fix expected upgrade command to match impl
| * Add spec tests for pkgutil package providerDominic Cleal2011-02-201-0/+132
| |
* | Merge branch '2.6.x' into nextMax Martin2011-04-131-0/+122
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: Updated CHANGELOG for 2.6.8rc1 (#2331) Remove darwinports pkg provider, replace with rewritten macports provider Fixed #7082 - Added system support for groups (#7018) Give more context on the service type's assumptions. Wording tweaks. (#7018) explain internals better in service provider documentation maint: Fix sqlite3 require to really be optional maint: Fix sporadic sqlite error (#6818) Stop from getting Rails 3 named_scope deprecation warning (#6856) Copy dangling symlinks with 'links => manage' File resource. Conflicts (Resolved manually): lib/puppet/type/group.rb spec/unit/indirector/facts/inventory_active_record_spec.rb
| * | (#2331) Remove darwinports pkg provider, replace with rewritten macports ↵Nigel Kersten2011-04-131-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | provider * Employs port -q installed, much faster than port list installed * Handles upgrades correctly now * Makes use of internal port revision for ensure => latest upgrades * Versionable, now works with ensure => specified_version * Does not handle port variants at all yet. * Does not allow manual specification of revision, only version * Test coverage expanded using newer syntax Paired-With: Daniel Pittman
* | | maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-1312-24/+12
| | | | | | | | | | | | | | | | | | | | | We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
* | | maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-0812-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* | | Merge branch '2.6.x' into nextMax Martin2011-04-071-1/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (maint) Indentation fixes (#6490) Add plugin initialization callback system to core Fix #4339 - Locally save the last report to $lastrunreport Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yaml Fixed #3127 - removed legacy debug code Fixed #3127 - Fixed gem selection regex (#5437) Invalidate cached TypeCollection when there was an error parsing (#6937) Adjust formatting of recurse's desc (#6937) Document the recurse parameter of File type. (#6893) Document the cron type in the case of specials. (#5670) Don't trigger refresh from a failed resource Fixed #6554 - Missing $haveftool if/else conditional in install.rb breaking Ruby 1.9 Conflicts (Manually resolved): lib/puppet/application/agent.rb lib/puppet/application/apply.rb lib/puppet/configurer.rb lib/puppet/resource/type_collection.rb lib/puppet/type/file.rb spec/integration/configurer_spec.rb spec/unit/application/agent_spec.rb spec/unit/application/apply_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector/report/yaml_spec.rb spec/unit/resource/type_collection_spec.rb Paired-with: Nick Lewis
| * | Fixed #3127 - Fixed gem selection regexJames Turnbull2011-04-041-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | Previously if the gem json_pure was installed and you requested the gem json then the regex matched too soon and falshly indicated that the json gem was already installed. Also updated to add the --no-ri and no-rdoc options and fix tests.
* | | Merge branch 'feature/next/6527-pip_package_provider' into nextMatt Robinson2011-03-221-4/+5
|\ \ \ | | | | | | | | | | | | | | | | * feature/next/6527-pip_package_provider: (#6527) Fix pip tests
| * | | (#6527) Fix pip testsMatt Robinson2011-03-221-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The testing of lazypip forgot to stub which, so they worked when pip was installed, but didn't work when it wasn't. Appropriate stubbing has been put in place, and stubs changed to expects for some stronger assertions about what's happening. Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* | | | Merge branch 'feature/next/6257-pip_package_provider' into nextMatt Robinson2011-03-221-0/+176
|\| | | | | | | | | | | | | | | | | | | | | | | * feature/next/6257-pip_package_provider: (#6527) Fix uninstall problem and refactor (#6527) Added pip package provider.
| * | | (#6527) Fix uninstall problem and refactorMatt Robinson2011-03-221-56/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uninstall wasn't working properly because the instances method relied on the pip command having been defined by calling lazy_pip. This lazy_pip pattern is a nice way of getting around Puppet's problem of disqualifying providers at the beginning of a run because the command doesn't yet exist even though part way through the run the command might exist. Really, we need to fix puppet to lazily evaluate a provider command for validity only at the time the provider is needed. The refactoring also pointed out that query could just reuse the logic from instances. The tests were also refactored to use real resources instead of stubbed ones, and they reflect the implementation changes to instances. Paired-with: Richard Crowley <r@rcrowley.org>
| * | | (#6527) Added pip package provider.Richard Crowley2011-03-221-0/+190
| | |/ | |/| | | | | | | | | | | | | Python's pip package manager is analogous to RubyGems and should be included in Puppet. Reviewed-by: Matt Robinson <matt@puppetlabs.com>
* / | maint: Change code for finding spec_helper to work with Ruby 1.9Matt Robinson2011-03-224-4/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the specs under Ruby 1.9 didn't work using the lambda to recurse down directories to find the spec_helper. Standardizing the way to find spec_helper like the rest of specs seemed like the way to go. Here's the command line perl I used to make the change: perl -p -i -e "s/Dir.chdir.*lambda.*spec_helper.*$/require File.expand_path(File.dirname(__FILE__) + '\/..\/..\/spec_helper')/" `find spec -name "*_spec.rb"` Then I fixed the number of dots for files that weren't two levels from the spec dir and whose tests failed. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.6.x' into nextMatt Robinson2011-02-021-0/+55
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (46 commits) Augmentation of tests for prior commit Fix to fix for #5755 -- backref serialization issues in zaml Fixed #5564 - Added some more fqdn_rand documentation Fixed #4968 - Updated list of options turned on by --test in documentation (#5061) - allow special hostclass/define variables to be evaluated as defaults. (#6107) Fix an error when auditing a file with empty content Remove already initialized constant warning from file_spec.rb tests (#5566) Treat source only File checksums as syntax errors when used with content Rename variable used in File type validation to be more clear Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. Remove order dependency when specifying source and checksum on File type Bug #5755 -- ZAML generates extra newline in some hash backreferences. bug #5681 -- code fix to handle AIX mount output Bug #5681 -- parse AIX mount command output. Spec for #5681 to allow parsing of AIX mount output in mount provider Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes Bug #6091 -- test leading double-slash in filenames are allowed. Fixed #6071 - Fixed typo and improved exec path error message Fixed #6061 - Allowed -1 as password min/max age Bug #6061 -- verify that negative {min,max}_password_age are accepted. ... Manually Resolved Conflicts: lib/puppet/util/zaml.rb spec/unit/util/zaml_spec.rb
| * Feature #5855 -- undefined method 'withenv' in FreeBSD package provider.Daniel Pittman2011-01-261-0/+55
| | | | | | | | | | | | The FreeBSD package provider fails to install when any source is given, yielding instead an 'undefined method' error. This adds tests that prove the bug exists.
* | maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson2010-12-066-6/+6
| | | | | | | | | | | | | | | | | | Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
* | (#2866) yum should support downgrade.Dan Bode2010-11-231-7/+13
| | | | | | | | | | | | | | | | | | | | patch originally from Grzegorz Nosek with contributions on the test from Oliver Hookins. checks if the current version is greater than the should version, if so, calls yum downgrade. Reviewed-by: Matt Robinson
* | (#4711) Provide unit tests for yum package provider.Dan Bode2010-11-231-0/+61
|/
* Code smell: Two space indentationMarkus Roberts2010-07-099-617/+617
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* Code smell: Inconsistent indentation and related formatting issuesMarkus Roberts2010-07-097-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 163 occurances of defined\? +([@a-zA-Z_.0-9?=]+) with defined?(\1) This makes detecting subsequent patterns easier. 3 Examples: The code: if ! defined? @parse_config becomes: if ! defined?(@parse_config) The code: return @option_parser if defined? @option_parser becomes: return @option_parser if defined?(@option_parser) The code: if defined? @local and @local becomes: if defined?(@local) and @local * Eliminate trailing spaces. Replaced 428 occurances of ^(.*?) +$ with \1 1 file was skipped. test/ral/providers/host/parsed.rb because 0 * Replace leading tabs with an appropriate number of spaces. Replaced 306 occurances of ^(\t+)(.*) with Tabs are not consistently expanded in all environments. * Don't arbitrarily wrap on sprintf (%) operator. Replaced 143 occurances of (.*['"] *%) +(.*) with Splitting the line does nothing to aid clarity and hinders further refactorings. 3 Examples: The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] The code: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] becomes: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] * Don't break short arrays/parameter list in two. Replaced 228 occurances of (.*) +(.*) with 3 Examples: The code: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) becomes: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) The code: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) becomes: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) The code: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") becomes: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") * If arguments must wrap, treat them all equally Replaced 510 occurances of lines ending in things like ...(foo, or ...(bar(1,3), with \1 \2 3 Examples: The code: midscope.to_hash(false), becomes: assert_equal( The code: botscope.to_hash(true), becomes: # bottomscope, then checking that we see the right stuff. The code: :path => link, becomes: * Replaced 4516 occurances of ^( *)(.*) with The present code base is supposed to use four-space indentation. In some places we failed to maintain that standard. These should be fixed regardless of the 2 vs. 4 space question. 15 Examples: The code: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc becomes: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc The code: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( becomes: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( The code: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } becomes: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } The code: #passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } becomes: # passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } The code: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") becomes: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") The code: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", becomes: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", The code: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do becomes: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do The code: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') becomes: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') The code: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) becomes: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) The code: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") becomes: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") The code: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } becomes: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } The code: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid becomes: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid The code: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' becomes: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' The code: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs becomes: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs The code: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element| becomes: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element|
* [#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts2010-06-289-0/+0
| | | | Part 2 re-did the change on the spec files, which it shouldn't have.
* [#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts2010-06-289-0/+0
| | | | | | | | | Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
* [#3994] rename the specs to have _spec.rb at the endMarkus Roberts2010-06-239-0/+0
| | | | | | | | | Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
* Fix ProviderDpkg specs to avoid any real executionsDavid Schmitt2010-02-171-0/+4
|
* Fixes #1999 - Allows the 'apt' provider to downgrade packages.Paul Lathrop2010-02-171-0/+7
| | | | | | | This is accomplished by adding the --force-yes option to the apt-get command line when a package version is specified. Signed-off-by: Paul Lathrop <plathrop@digg.com>
* Added support for flat packages in the pkgdmg package provider.Roy Nielsen2010-02-171-5/+16
| | | | | | | | | | | | | | Added a test in: ./spec/unit/provider/package/pkgdmg.rb To test flat package support. The case where a package is a .pkg bundle, curl will attempt to download and not work. The "installer" command will then fail, as the source will be "not found" and the resource will fail. The puppet run will continue. Signed-off-by: Roy Nielsen <rsn@lanl.gov>
* Fixes #2836. Add hold support to dpkg providerNigel Kersten2010-02-171-2/+53
|
* Fixes #1223 Add Zypper support for SuSE machinesRein Henrichs2010-02-171-0/+81
| | | | | | | | | | | | | | | | | | | Zypper is the replacement for `rug' from earlier SuSE releases. Zypper is backward compatible with the rug command (mostly) and supports most of the same commands that rug does. This version fixes a number of bugs in the original: * when installing with a specified version, fix bug where the package name was being doubled ("foo" became "foofoo"). * fix bug where package name and version were separated by a "=" when it should have been a "-". * Update specs to reflect the implementation's use of the "-l" flag as recommended in http://groups.google.com/group/puppet-dev/msg/d86416c079bd3faf Signed-off-by: Rein Henrichs <reinh@reinh.com>
* Add AIX package management support (installp&nim)Andrew Forgue2010-02-172-0/+108
| | | | | | | | | | This patch adds support for the native AIX package manager. It allows installation from either the name of an lpp_source (if you have a NIM environment configured, or from a directory containing .bff files. Signed-off-by: Andrew Forgue <andrew.forgue@gmail.com>
* Fixing tests in pkg providerMarkus Roberts2010-02-171-6/+6
|
* First shot at the OpenSolaris pkg(5) providerMartin Englund2010-01-271-0/+63
|
* Ticket #2665: Regexp exception on ++ in package namesMarkus Roberts2009-10-251-0/+7
| | | | | | | | | | | This affects several providers: dpkg, rug, up2date, urpmi Fixed by escaping the package names with Regexp.escape Patch by Jesse Wolf Signed-off-by: Markus Roberts <Markus@reality.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-062-15/+15
|
* Fix #2142 - Convert pkgdmg provider to use plists instead of string scanning ↵Nigel Kersten2009-04-221-0/+73
| | | | | | | | | | | | | | for future proofing update pkgdmg patch with feedback from dev-list initial checking of pkgdmg package provider tests clean up fail conditions to raise Puppet::Error instead Finalized tests for pkgdmg provider remove duplicate facter/util/plist require
* Migrating the apt and dpkg tests to rspec.Luke Kanies2008-10-022-0/+301
| | | | | | | I left the aptitude and aptrpm tests as an exercise for the reader. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixed #1508 - Add HP-UX package provider.Mark Plaksin2008-08-201-0/+52
|
* Fixed #1226 - Gems can now specify source repositories.Luke Kanies2008-07-071-9/+57
| | | | | | | | | Added tests for the bit that's changed here (and caught a couple of bugs in the original patch). This is all a modification of Sam Quigley's work. Signed-off-by: Luke Kanies <luke@madstop.com>