Skip to content

Commit

Permalink
test(inspec): fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jun 25, 2019
1 parent d4e6442 commit 84e697a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 43 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ coverage.xml
.hypothesis/
.kitchen
.kitchen.local.yml
<<<<<<< HEAD
kitchen.local.yml
=======
>>>>>>> 873ae0f132f728b86d0f7d910dd383c34f5f1fb8

# Translations
*.mo
Expand Down Expand Up @@ -106,7 +103,6 @@ ENV/
# mypy
.mypy_cache/

<<<<<<< HEAD
# Bundler
Gemfile.lock

Expand All @@ -115,7 +111,3 @@ docs/*.md

# Vim
*.sw?
=======
# copied `.md` files used for conversion to `.rst` using `m2r`
docs/*.md
>>>>>>> 873ae0f132f728b86d0f7d910dd383c34f5f1fb8
40 changes: 16 additions & 24 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@
# vim: ft=yaml
---
sysstat:
version: '12.1.5'
pkg:
use_upstream_source: False
archive:
uri: https://dl.sysstat.com/oss/release

pkgrepo:
humanname: sysstat_official
name: deb https://packages.sysstat.com/oss/deb stable main
file: /etc/apt/sources.list.d/sysstat.list
key_url: https://packages.sysstat.com/gpg.key
config_file: /etc/sysstat/sysstat.ini
environ_file: /etc/default.sysstat.sh
service:
name: sysstat-server

linux:
#'Alternatives system' priority: zero disables (default)
altpriority: 1000
# Pillar-based config
# See also https://sysstat.com/docs/installation/configuration/
environ:
- 'export PATH=${PATH}:/opt/sysstat-6.2.2.darwin-amd64'
config:
default:
instance_name: ${HOSTNAME}
security:
admin_user: admin
auth.google:
client_secret: 0ldS3cretKey

tofs:
# The files_switch key serves as a selector for alternative
Expand All @@ -44,14 +43,7 @@ sysstat:
# - 'example_alt.tmpl'
# - 'example_alt.tmpl.jinja'

# Pillar-based config
# See also https://sysstat.com/docs/installation/configuration/
environ:
- 'export PATH=${PATH}:/opt/sysstat-6.2.2.darwin-amd64'
config:
default:
instance_name: ${HOSTNAME}
security:
admin_user: admin
auth.google:
client_secret: 0ldS3cretKey
linux:
#'Alternatives system' priority: zero disables (default)
altpriority: 1000

2 changes: 1 addition & 1 deletion sysstat/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sysstat:
kernel: ''
arch: ''
rootgroup: root
config_file: /etc/default/sysstat
config_file: /etc/default/sysstat.ini
config:
path: /etc/default/sysstat
enabled: "true"
Expand Down
6 changes: 4 additions & 2 deletions test/integration/default/controls/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
control 'sysstat configuration' do
title 'should match desired lines'

describe file('/etc/default/sysstat') do
describe file('/etc/default/sysstat.ini') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
its('mode') { should cmp '0640' }
its('content') { should include 'Default settings for ' }
its('content') { should include 'ENABLED' }
its('content') { should include 'SA1_OPTIONS="-S DISK"' }

end
end
16 changes: 8 additions & 8 deletions test/integration/default/controls/environ_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
control 'sysstat configuration environment' do
title 'should match desired lines'

# describe file('/etc/default/sysstat.sh') do
# it { should be_file }
# it { should be_owned_by 'root' }
# it { should be_grouped_into 'root' }
# its('mode') { should cmp '0640' }
# its('content') { should include 'Your changes may be overwritten' }
# its('content') { should include 'export PATH=${PATH}:/usr/local/bin' }
# end
describe file('/etc/default/sysstat.sh') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0640' }
its('content') { should include 'Your changes may be overwritten' }
its('content') { should include 'export PATH=' }
end
end

0 comments on commit 84e697a

Please sign in to comment.