-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(inspec): add tests for package, config & service
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'Docker configuration' do | ||
title 'should match desired lines' | ||
|
||
describe file('/etc/default/docker') do | ||
it { should be_file } | ||
its('owner') { should eq 'root' } | ||
its('group') { should eq 'root' } | ||
its('mode') { should cmp '0644' } | ||
its('content') { should include 'DOCKER_OPTS="-s btrfs --dns 8.8.8.8"' } | ||
its('content') { should include 'export http_proxy="http://172.17.42.1:3128"' } | ||
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'Docker package' do | ||
title 'should be installed' | ||
|
||
package_name = | ||
case platform[:family] | ||
when 'debian' | ||
'docker-ce' | ||
# Catch remaining `linux` platforms to identify by `name` at the end | ||
when 'linux' | ||
case platform[:name] | ||
when 'arch' | ||
'docker' | ||
end | ||
end | ||
|
||
describe package(package_name) do | ||
it { should be_installed } | ||
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'Docker service' do | ||
title 'should be running and enabled' | ||
|
||
describe service('docker') do | ||
it { should be_installed } | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end |