Sha256: 6ca6027c922e19564eee2b695e7871967160022479b1f49d7765a89191bd04c4

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'serverspec'

details = {}

if RUBY_PLATFORM =~ /(win|mswin|mingw)/i
  set :backend, :cmd
  set :os, :family => 'windows'
  details = {
    check_owner:      false,
    config:           "c:\\Program Files (x86)\\Instrumental Tools\\etc\\instrumental.yml",
    has_pid:          false,
    service_name:     "Instrument Server"
  }
else
  set :backend, :exec
  details = {
    check_owner:      true,
    config:           "/etc/instrumental.yml",
    has_pid:          true,
    pid_path:         "/opt/instrumental-tools/instrument_server.pid",
    owner:            "nobody",
    service_name:     "instrument_server"
  }
end

describe service(details[:service_name]) do
  it { should be_enabled }
  it { should be_running }
end

if details[:has_pid]
  describe file(details[:pid_path]) do
    it { should be_file }
    if details[:check_owner]
      it { should be_owned_by(details[:owner]) }
    end
  end
end

describe file(details[:config]) do
  it { should be_file }
  if details[:check_owner]
    it { should be_owned_by(details[:owner]) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
instrumental_tools-1.1.4 test/integration/default/serverspec/instrumental_tools_spec.rb
instrumental_tools-1.1.3 test/integration/default/serverspec/instrumental_tools_spec.rb