Sha256: 13f1e6533f5b0f31b373d9e95d603fd39130c759eae756dea838e54c6e9c7bf7

Contents?: true

Size: 1.41 KB

Versions: 152

Compression:

Stored size: 1.41 KB

Contents

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

describe Puppet::Type.type(:service).provider(:windows), '(integration)',
  :if => Puppet.features.microsoft_windows? do

  require 'puppet/util/windows'

  before :each do
    Puppet::Type.type(:service).stubs(:defaultprovider).returns described_class
  end

  context 'should fail querying services that do not exist' do
    let(:service) do
      Puppet::Type.type(:service).new(:name => 'foobarservice1234')
    end

    it "with a Puppet::Error when querying enabled?" do
      expect { service.provider.enabled? }.to raise_error(Puppet::Error)
    end

    it "with a Puppet::Error when querying status" do
      expect { service.provider.status }.to raise_error(Puppet::Error)
    end
  end

  context 'should return valid values when querying a service that does exist' do
    let(:service) do
      # This service should be ubiquitous across all supported Windows platforms
      Puppet::Type.type(:service).new(:name => 'lmhosts')
    end

    it "with a valid enabled? value when asked if enabled" do
      expect([:true, :false, :manual]).to include(service.provider.enabled?)
    end

    it "with a valid status when asked about status" do
      expect([
        :running,
        :'continue pending',
        :'pause pending',
        :paused,
        :running,
        :'start pending',
        :'stop pending',
        :stopped]).to include(service.provider.status)
    end
  end
end

Version data entries

152 entries across 152 versions & 1 rubygems

Version Path
puppet-5.5.6 spec/integration/provider/service/windows_spec.rb
puppet-5.5.6-x86-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.6-x64-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.6-universal-darwin spec/integration/provider/service/windows_spec.rb
puppet-5.5.3 spec/integration/provider/service/windows_spec.rb
puppet-5.5.3-x86-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.3-x64-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.3-universal-darwin spec/integration/provider/service/windows_spec.rb
puppet-5.5.2 spec/integration/provider/service/windows_spec.rb
puppet-5.5.2-x86-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.2-x64-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.5.2-universal-darwin spec/integration/provider/service/windows_spec.rb
puppet-5.3.7 spec/integration/provider/service/windows_spec.rb
puppet-5.3.7-x86-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.3.7-x64-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-5.3.7-universal-darwin spec/integration/provider/service/windows_spec.rb
puppet-4.10.12 spec/integration/provider/service/windows_spec.rb
puppet-4.10.12-x86-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-4.10.12-x64-mingw32 spec/integration/provider/service/windows_spec.rb
puppet-4.10.12-universal-darwin spec/integration/provider/service/windows_spec.rb