-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull listener/backend configuration out into separate arguments, sinc…
…e they're required; only manage service if they're set. Fix shell escaping and quoting in init scripts.
- Loading branch information
Evan Krall
committed
Jun 18, 2015
1 parent
957b87f
commit 37257d1
Showing
9 changed files
with
189 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,80 @@ | ||
require 'spec_helper' | ||
|
||
describe 'vault' do | ||
RSpec.configure do |c| | ||
c.default_facts = { | ||
:architecture => 'x86_64', | ||
:operatingsystem => 'Ubuntu', | ||
:lsbdistrelease => '10.04', | ||
:kernel => 'Linux', | ||
} | ||
end | ||
|
||
context 'Should compile with no arguments' do | ||
let(:pre_condition) { 'Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }' } | ||
it { should compile } | ||
end | ||
RSpec.configure do |c| | ||
c.default_facts = { | ||
:architecture => 'x86_64', | ||
:operatingsystem => 'Ubuntu', | ||
:lsbdistrelease => '10.04', | ||
:kernel => 'Linux', | ||
} | ||
end | ||
|
||
let(:pre_condition) { 'Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }' } | ||
context 'Should compile with no arguments' do | ||
it { should compile } | ||
end | ||
|
||
context 'properly escaped shellwords debian' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz baz baz'], | ||
:init_style => 'debian', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { should contain_file('/etc/init.d/vault').with_content(%r{^DAEMON_ARGS=\( server -config /etc/vault foo bar baz\\ baz\\ baz \)})} | ||
end | ||
|
||
context 'properly escaped shellwords sles' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz baz baz'], | ||
:init_style => 'sles', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { should contain_file('/etc/init.d/vault').with_content(%r{server -config "\$CONFIG_DIR" foo bar baz\\ baz\\ baz})} | ||
end | ||
|
||
context 'properly escaped shellwords systemd' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz baz baz'], | ||
:init_style => 'systemd', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { should contain_file('/lib/systemd/system/vault.service').with_content(%r{-config /etc/vault foo bar baz\\ baz\\ baz})} | ||
end | ||
|
||
context 'properly escaped shellwords launchd' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz <baz> baz'], | ||
:init_style => 'launchd', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { | ||
should contain_file('/Library/LaunchDaemons/io.vaultproject.daemon.plist') \ | ||
.with_content(%r{<string>foo</string>\n\s*<string>bar</string>\n\s*<string>baz <baz> baz</string>}) | ||
} | ||
end | ||
|
||
context 'properly escaped shellwords sysv' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz baz baz'], | ||
:init_style => 'sysv', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { should contain_file('/etc/init.d/vault').with_content(%r{server -config "\$CONFIG" foo bar baz\\ baz\\ baz})} | ||
end | ||
|
||
context 'properly escaped shellwords upstart' do | ||
let(:params) {{ | ||
:extra_options => ['foo', 'bar', 'baz baz baz'], | ||
:init_style => 'upstart', | ||
:backend => {}, | ||
:listener => {}, | ||
}} | ||
it { should contain_file('/etc/init/vault.conf').with_content(%r{server -config "\$CONFIG" foo bar baz\\ baz\\ baz})} | ||
end | ||
end |
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
Oops, something went wrong.