Sha256: 1e380025ae0065432f700641a1e075aad436516a840798f74651e6a94a01ab34

Contents?: true

Size: 1.96 KB

Versions: 33

Compression:

Stored size: 1.96 KB

Contents

#!/usr/bin/env rspec
require 'spec_helper'

describe Puppet::Util::RunMode do
  before do
    @run_mode = Puppet::Util::RunMode.new('fake')
  end

  it "should have confdir /etc/puppet when run as root" do
    Puppet.features.stubs(:root?).returns(true)
    etcdir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : '/etc/puppet'
    # REMIND: issue with windows backslashes
    @run_mode.conf_dir.should == File.expand_path(etcdir)
  end

  it "should have confdir ~/.puppet when run as non-root" do
    Puppet.features.stubs(:root?).returns(false)
    @run_mode.expects(:expand_path).with("~/.puppet").returns("~/.puppet")
    @run_mode.conf_dir.should == "~/.puppet"
  end

  it "should have vardir /var/lib/puppet when run as root" do
    Puppet.features.stubs(:root?).returns(true)
    vardir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : '/var/lib/puppet'
    # REMIND: issue with windows backslashes
    @run_mode.var_dir.should == File.expand_path(vardir)
  end

  it "should have vardir ~/.puppet/var when run as non-root" do
    Puppet.features.stubs(:root?).returns(false)
    @run_mode.expects(:expand_path).with("~/.puppet/var").returns("~/.puppet/var")
    @run_mode.var_dir.should == "~/.puppet/var"
  end

  it "should have rundir depend on vardir" do
    @run_mode.run_dir.should == '$vardir/run'
  end

  it "should have logopts return an array with $vardir/log if runmode is not master" do
    @run_mode.expects(:master?).returns false
    @run_mode.logopts.should == ["$vardir/log", "The Puppet log directory."]
  end

  it "should have logopts return a hash with $vardir/log and other metadata if runmode is master" do
    @run_mode.expects(:master?).returns true
    @run_mode.logopts.should == {
      :default => "$vardir/log",
      :mode    => 0750,
      :owner   => "service",
      :group   => "service",
      :desc    => "The Puppet log directory.",
    }
  end
end

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/util/run_mode_spec.rb
puppet-2.7.25 spec/unit/util/run_mode_spec.rb
puppet-2.7.24 spec/unit/util/run_mode_spec.rb
puppet-2.7.23 spec/unit/util/run_mode_spec.rb
puppet-2.7.22 spec/unit/util/run_mode_spec.rb
puppet-2.7.21 spec/unit/util/run_mode_spec.rb
puppet-2.7.20 spec/unit/util/run_mode_spec.rb
puppet-2.7.20.rc1 spec/unit/util/run_mode_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/util/run_mode_spec.rb
puppet-2.7.19 spec/unit/util/run_mode_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/run_mode_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/util/run_mode_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/run_mode_spec.rb
puppet-2.7.18 spec/unit/util/run_mode_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/run_mode_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/run_mode_spec.rb
puppet-2.7.17 spec/unit/util/run_mode_spec.rb
puppet-2.7.16 spec/unit/util/run_mode_spec.rb
puppet-2.7.14 spec/unit/util/run_mode_spec.rb
puppet-2.7.13 spec/unit/util/run_mode_spec.rb