Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port integration test and chef recipe to support installing on windows
- Loading branch information
Chris
committed
Jun 30, 2015
1 parent
ca95235
commit 2b3d60d
Showing
5 changed files
with
139 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 39 additions & 14 deletions
53
test/integration/default/serverspec/instrumental_tools_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,55 @@ | ||
require 'serverspec' | ||
|
||
set :backend, :exec | ||
details = {} | ||
|
||
if RUBY_PLATFORM =~ /(win|mswin|mingw)/i | ||
set :backend, :cmd | ||
set :os, :family => 'windows' | ||
details = { | ||
check_executable: false, | ||
check_owner: false, | ||
config: "c:\\Program Files (x86)\\Instrumental Tools\\etc\\instrumental.yml", | ||
executable: "c:\\Program Files (x86)\\Instrumental Tools\\instrument_server.bat", | ||
has_pid: false | ||
} | ||
else | ||
set :backend, :exec | ||
details = { | ||
check_executable: true, | ||
check_owner: true, | ||
config: "/etc/instrumental.yml", | ||
executable: "/opt/instrumental-tools/instrument_server", | ||
has_pid: true, | ||
pid_path: "/opt/instrumental-tools/instrument_server.pid", | ||
owner: "nobody" | ||
} | ||
end | ||
|
||
|
||
describe file('/opt/instrumental-tools/instrument_server') do | ||
describe file(details[:executable]) do | ||
it { should be_file } | ||
it { should be_executable } | ||
if details[:check_executable] | ||
it { should be_executable } | ||
end | ||
end | ||
|
||
describe service('instrument_server') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe file('/opt/instrumental-tools/instrument_server.pid') do | ||
it { should be_file } | ||
it { should be_owned_by('nobody') } | ||
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('/etc/instrumental.yml') do | ||
describe file(details[:config]) do | ||
it { should be_file } | ||
it { should be_owned_by('nobody') } | ||
end | ||
|
||
describe process('ruby') do | ||
it { should be_running } | ||
its(:user) { should eq 'nobody' } | ||
its(:args) { should match /instrument_server/ } | ||
if details[:check_owner] | ||
it { should be_owned_by(details[:owner]) } | ||
end | ||
end |