From 84e697a181504b871d3ec5a80dfbceeacac1a3a5 Mon Sep 17 00:00:00 2001 From: N Date: Tue, 25 Jun 2019 16:57:08 +0100 Subject: [PATCH] test(inspec): fix unit test --- .gitignore | 8 ---- pillar.example | 40 ++++++++----------- sysstat/defaults.yaml | 2 +- .../default/controls/config_spec.rb | 6 ++- .../default/controls/environ_spec.rb | 16 ++++---- 5 files changed, 29 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 79741b6..ba07ed8 100644 --- a/.gitignore +++ b/.gitignore @@ -47,10 +47,7 @@ coverage.xml .hypothesis/ .kitchen .kitchen.local.yml -<<<<<<< HEAD kitchen.local.yml -======= ->>>>>>> 873ae0f132f728b86d0f7d910dd383c34f5f1fb8 # Translations *.mo @@ -106,7 +103,6 @@ ENV/ # mypy .mypy_cache/ -<<<<<<< HEAD # Bundler Gemfile.lock @@ -115,7 +111,3 @@ docs/*.md # Vim *.sw? -======= -# copied `.md` files used for conversion to `.rst` using `m2r` -docs/*.md ->>>>>>> 873ae0f132f728b86d0f7d910dd383c34f5f1fb8 diff --git a/pillar.example b/pillar.example index a7b3b03..1ddcf92 100644 --- a/pillar.example +++ b/pillar.example @@ -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 @@ -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 + diff --git a/sysstat/defaults.yaml b/sysstat/defaults.yaml index a0d136d..0783344 100644 --- a/sysstat/defaults.yaml +++ b/sysstat/defaults.yaml @@ -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" diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb index d47ca2f..49d19d5 100644 --- a/test/integration/default/controls/config_spec.rb +++ b/test/integration/default/controls/config_spec.rb @@ -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 diff --git a/test/integration/default/controls/environ_spec.rb b/test/integration/default/controls/environ_spec.rb index d0d80b2..eaf0c99 100644 --- a/test/integration/default/controls/environ_spec.rb +++ b/test/integration/default/controls/environ_spec.rb @@ -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