-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(inspec): move common controls to the
share
profile
- Loading branch information
Showing
6 changed files
with
73 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# https://docs.chef.io/inspec/profiles/#including-all-controls-from-a-profile | ||
# Could use `include_controls` in this scenario | ||
# include_controls 'share' | ||
|
||
# https://docs.chef.io/inspec/profiles/#selectively-including-controls-from-a-profile | ||
# However, using `require_controls` for more clarity | ||
require_controls 'share' do | ||
control 'Postgres command' | ||
control 'Postgres configuration' | ||
# control 'Postgres service' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
service_name = | ||
case platform[:family] | ||
when 'redhat', 'fedora', 'suse' | ||
case system.platform[:release] | ||
when 'tumbleweed' | ||
'postgresql' | ||
else | ||
'postgresql-13' | ||
end | ||
else | ||
'postgresql' | ||
end | ||
|
||
pg_port = | ||
case platform[:family] | ||
when 'debian', 'suse' | ||
5433 | ||
else | ||
5432 | ||
end | ||
|
||
control 'Postgres service' do | ||
impact 0.5 | ||
title 'should be installed, enabled and running' | ||
|
||
describe service(service_name) do | ||
it { should be_installed } | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe port(pg_port) do | ||
it { should be_listening } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# https://docs.chef.io/inspec/profiles/#including-all-controls-from-a-profile | ||
# Could use `include_controls` in this scenario | ||
# include_controls 'share' | ||
|
||
# https://docs.chef.io/inspec/profiles/#selectively-including-controls-from-a-profile | ||
# However, using `require_controls` for more clarity | ||
require_controls 'share' do | ||
control 'Postgres command' | ||
control 'Postgres configuration' | ||
# control 'Postgres service' | ||
end |
File renamed without changes.
File renamed without changes.