Sha256: 28ce46b458d46eddd5e477a91593e9e130f62d7bd2f4a045a582543cd187ee6d

Contents?: true

Size: 1.64 KB

Versions: 19

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../spec_helper'

provider_class = Puppet::Type.type(:zone).provider(:solaris)

describe provider_class do
  before do
    @resource = stub("resource", :name => "mypool")
    @resource.stubs(:[]).returns "shouldvalue"
    @provider = provider_class.new(@resource)
  end

  describe "when calling configure" do
    it "should add the create args to the create str" do
      @resource.stubs(:properties).returns([])
      @resource.stubs(:[]).with(:create_args).returns("create_args")
      @provider.expects(:setconfig).with("create -b create_args\nset zonepath=shouldvalue\ncommit\n")
      @provider.configure
    end
  end

  describe "when installing" do
    it "should call zoneadm" do
      @provider.expects(:zoneadm)
      @provider.install
    end

    describe "when cloning" do
      before { @resource.stubs(:[]).with(:clone).returns(:clone_argument) }

      it "sohuld clone with the resource's clone attribute" do
        @provider.expects(:zoneadm).with(:clone, :clone_argument)
        @provider.install
      end
    end

    describe "when not cloning" do
      before { @resource.stubs(:[]).with(:clone).returns(nil)}

      it "should just install if there are no install args" do
        @resource.stubs(:[]).with(:install_args).returns(nil)
        @provider.expects(:zoneadm).with(:install)
        @provider.install
      end

      it "should add the install args to the command if they exist" do
        @resource.stubs(:[]).with(:install_args).returns("install args")
        @provider.expects(:zoneadm).with(:install, ["install", "args"])
        @provider.install
      end
    end
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.17 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.16 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.15 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.14 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.13 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.12 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.11 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.10 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.9 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.8 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.7 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.6 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.5 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.4 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.3 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.2 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.1 spec/unit/provider/zone/solaris_spec.rb
puppet-2.6.0 spec/unit/provider/zone/solaris_spec.rb