Sha256: 31bdfc7ded141b94925c5ecbd177321917e5c5967953928eb98afefef86bff19

Contents?: true

Size: 1.59 KB

Versions: 39

Compression:

Stored size: 1.59 KB

Contents

#! /usr/bin/env ruby

require 'spec_helper'
require 'facter'

describe "Puppet::Util::Windows::Process", :if => Puppet.features.microsoft_windows?  do
  describe "as an admin" do
    it "should have the SeCreateSymbolicLinkPrivilege necessary to create symlinks on Vista / 2008+",
      :if => Facter.value(:kernelmajversion).to_f >= 6.0 && Puppet.features.microsoft_windows? do
      # this is a bit of a lame duck test since it requires running user to be admin
      # a better integration test would create a new user with the privilege and verify
      Puppet::Util::Windows::User.should be_admin
      Puppet::Util::Windows::Process.process_privilege_symlink?.should be_true
    end

    it "should not have the SeCreateSymbolicLinkPrivilege necessary to create symlinks on 2003 and earlier",
      :if => Facter.value(:kernelmajversion).to_f < 6.0 && Puppet.features.microsoft_windows? do
      Puppet::Util::Windows::User.should be_admin
      Puppet::Util::Windows::Process.process_privilege_symlink?.should be_false
    end

    it "should be able to lookup a standard Windows process privilege" do
      Puppet::Util::Windows::Process.lookup_privilege_value('SeShutdownPrivilege') do |luid|
        luid.should_not be_nil
        luid.should be_instance_of(Puppet::Util::Windows::Process::LUID)
      end
    end

    it "should raise an error for an unknown privilege name" do
      fail_msg = /LookupPrivilegeValue\(, foo, .*\):  A specified privilege does not exist/
      expect { Puppet::Util::Windows::Process.lookup_privilege_value('foo') }.to raise_error(Puppet::Util::Windows::Error, fail_msg)
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/integration/util/windows/process_spec.rb
puppet-3.8.7-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.7-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.6 spec/integration/util/windows/process_spec.rb
puppet-3.8.6-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.6-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.5 spec/integration/util/windows/process_spec.rb
puppet-3.8.5-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.5-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.4 spec/integration/util/windows/process_spec.rb
puppet-3.8.4-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.4-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.3 spec/integration/util/windows/process_spec.rb
puppet-3.8.3-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.3-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.2 spec/integration/util/windows/process_spec.rb
puppet-3.8.2-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.2-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-3.8.1 spec/integration/util/windows/process_spec.rb
puppet-3.8.1-x86-mingw32 spec/integration/util/windows/process_spec.rb