Sha256: 3038bc25ae3d9107129df537714ae44fb7bcf3445497030674eadbf44190e8d8

Contents?: true

Size: 1.62 KB

Versions: 30

Compression:

Stored size: 1.62 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
      expect(Puppet::Util::Windows::User).to be_admin
      expect(Puppet::Util::Windows::Process.process_privilege_symlink?).to be_truthy
    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
      expect(Puppet::Util::Windows::User).to be_admin
      expect(Puppet::Util::Windows::Process.process_privilege_symlink?).to be_falsey
    end

    it "should be able to lookup a standard Windows process privilege" do
      Puppet::Util::Windows::Process.lookup_privilege_value('SeShutdownPrivilege') do |luid|
        expect(luid).not_to be_nil
        expect(luid).to 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

30 entries across 30 versions & 1 rubygems

Version Path
puppet-4.3.2 spec/integration/util/windows/process_spec.rb
puppet-4.3.2-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.3.2-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.3.1 spec/integration/util/windows/process_spec.rb
puppet-4.3.1-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.3.1-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.3.0 spec/integration/util/windows/process_spec.rb
puppet-4.3.0-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.3.0-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.3 spec/integration/util/windows/process_spec.rb
puppet-4.2.3-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.3-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.2 spec/integration/util/windows/process_spec.rb
puppet-4.2.2-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.2-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.1 spec/integration/util/windows/process_spec.rb
puppet-4.2.1-x86-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.1-x64-mingw32 spec/integration/util/windows/process_spec.rb
puppet-4.2.0 spec/integration/util/windows/process_spec.rb
puppet-4.2.0-x86-mingw32 spec/integration/util/windows/process_spec.rb