diff options
| author | Andrew Forgue <andrew.forgue@gmail.com> | 2009-12-07 17:43:09 -0500 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | bca7e2c2cca97c33466609e299122c448e669b22 (patch) | |
| tree | 68428b9a6a57788ef85afce00cbbea0582c3486e /spec | |
| parent | b2c9455293796ab1d726314f6e5d2bd021fd648c (diff) | |
Add AIX package management support (installp&nim)
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>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/provider/package/aix.rb | 66 | ||||
| -rwxr-xr-x | spec/unit/provider/package/nim.rb | 42 |
2 files changed, 108 insertions, 0 deletions
diff --git a/spec/unit/provider/package/aix.rb b/spec/unit/provider/package/aix.rb new file mode 100755 index 000000000..691749df9 --- /dev/null +++ b/spec/unit/provider/package/aix.rb @@ -0,0 +1,66 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +provider_class = Puppet::Type.type(:package).provider(:aix) + +describe provider_class do + before(:each) do + # Create a mock resource + @resource = stub 'resource' + + # A catch all; no parameters set + @resource.stubs(:[]).returns(nil) + + # But set name and source + @resource.stubs(:[]).with(:name).returns "mypackage" + @resource.stubs(:[]).with(:source).returns "mysource" + @resource.stubs(:[]).with(:ensure).returns :installed + + @provider = provider_class.new + @provider.resource = @resource + end + + [:install, :uninstall, :latest, :query, :update].each do |method| + it "should have a #{method} method" do + @provider.should respond_to(method) + end + end + + it "should uninstall a package" do + @provider.expects(:installp).with('-gu', 'mypackage') + @provider.uninstall + end + + describe "when installing" do + it "should install a package" do + @resource.stubs(:should).with(:ensure).returns(:installed) + @provider.expects(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage') + @provider.install + end + + it "should install a specific package version" do + @resource.stubs(:should).with(:ensure).returns("1.2.3.4") + @provider.expects(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage 1.2.3.4') + @provider.install + end + end + + describe "when finding the latest version" do + it "should return the current version when no later version is present" do + @provider.stubs(:latest_info).returns(nil) + @provider.stubs(:properties).returns( { :ensure => "1.2.3.4" } ) + @provider.latest.should == "1.2.3.4" + end + + it "should return the latest version of a package" do + @provider.stubs(:latest_info).returns( { :version => "1.2.3.5" } ) + @provider.latest.should == "1.2.3.5" + end + end + + it "update should install a package" do + @provider.expects(:install).with(false) + @provider.update + end +end diff --git a/spec/unit/provider/package/nim.rb b/spec/unit/provider/package/nim.rb new file mode 100755 index 000000000..2018f6506 --- /dev/null +++ b/spec/unit/provider/package/nim.rb @@ -0,0 +1,42 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +provider_class = Puppet::Type.type(:package).provider(:nim) + +describe provider_class do + before(:each) do + # Create a mock resource + @resource = stub 'resource' + + # A catch all; no parameters set + @resource.stubs(:[]).returns(nil) + + # But set name and source + @resource.stubs(:[]).with(:name).returns "mypackage" + @resource.stubs(:[]).with(:source).returns "mysource" + @resource.stubs(:[]).with(:ensure).returns :installed + + @provider = provider_class.new + @provider.resource = @resource + end + + it "should have an install method" do + @provider = provider_class.new + @provider.should respond_to(:install) + end + + describe "when installing" do + it "should install a package" do + @resource.stubs(:should).with(:ensure).returns(:installed) + @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets='mypackage'") + @provider.install + end + + it "should install a versioned package" do + @resource.stubs(:should).with(:ensure).returns("1.2.3.4") + @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets='mypackage 1.2.3.4'") + @provider.install + end + end + end |
