diff options
| author | Roy Nielsen <rsn@lanl.gov> | 2010-03-26 13:25:21 -0600 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | eafde5cacaac79da79d9d1415618801fcc37edcc (patch) | |
| tree | 5b16f5257095d37af8fe70e49e6e374fe455f614 /spec | |
| parent | c9e3d75951d507059d25b76720d36a8d6d33be65 (diff) | |
| download | puppet-eafde5cacaac79da79d9d1415618801fcc37edcc.tar.gz puppet-eafde5cacaac79da79d9d1415618801fcc37edcc.tar.xz puppet-eafde5cacaac79da79d9d1415618801fcc37edcc.zip | |
Added support for flat packages in the pkgdmg package provider.
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>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/provider/package/pkgdmg.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/unit/provider/package/pkgdmg.rb b/spec/unit/provider/package/pkgdmg.rb index d43757401..3f007e01b 100755 --- a/spec/unit/provider/package/pkgdmg.rb +++ b/spec/unit/provider/package/pkgdmg.rb @@ -9,8 +9,9 @@ describe provider do @resource = stub 'resource', :[] => "dummypkgdmg" @provider = provider.new(@resource) - @fakemountpoint = "/tmp/dmg.foo" - @fakehdiutilinfo = {"system-entities" => [{"mount-point" => @fakemountpoint}] } + @fakemountpoint = "/tmp/dmg.foo" + @fakepkgfile = "/tmp/test.pkg" + @fakehdiutilinfo = {"system-entities" => [{"mount-point" => @fakemountpoint}] } @fakehdiutilplist = Plist::Emit.dump(@fakehdiutilinfo) @hdiutilmountargs = ["mount", "-plist", "-nobrowse", "-readonly", @@ -36,8 +37,8 @@ describe provider do lambda { @provider.install }.should raise_error(Puppet::Error) end - it "the source does not end in .dmg" do - @resource.stubs(:[]).with(:source).returns "notendingindotdmg" + it "the source does not end in .dmg or .pkg" do + @resource.stubs(:[]).with(:source).returns "notendingindotdmgorpkg" lambda { @provider.install }.should raise_error(Puppet::Error) end @@ -48,7 +49,7 @@ describe provider do end # These tests shouldn't be this messy. The pkgdmg provider needs work... - describe "when installing" do + describe "when installing a pkgdmg" do before do fh = mock 'filehandle' fh.stubs(:path).yields "/tmp/foo" @@ -70,4 +71,14 @@ describe provider do @provider.install end end + + describe "when installing flat pkg file" do + it "should call installpkg if a flat pkg file is found instead of a .dmg image" do + @resource.stubs(:[]).with(:source).returns "/tmp/test.pkg" + @resource.stubs(:[]).with(:name).returns "testpkg" + @provider.class.expects(:installpkgdmg).with("#{@fakepkgfile}", "testpkg").returns "" + @provider.install + end + end + end |
