From 154213560f4a2fccec3e816a910c248053f5d1d6 Mon Sep 17 00:00:00 2001 From: Adam Mendlik Date: Fri, 21 Apr 2017 10:07:39 -0600 Subject: [PATCH 1/3] Correct typo in .kitchen.yml This change has no impact on the kitchen tests, but only changes a symbolic name from 'openssl' to 'openssh' to avoid confusion. --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index fa97d23..659e471 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -19,8 +19,8 @@ provisioner: top.sls: base: '*': - - openssl - openssl.sls: + - openssh + openssh.sls: openssh: sshd_config_mode: '600' From 0c363d284ecfbc82aaecdc6537a40939e20a2f9c Mon Sep 17 00:00:00 2001 From: Adam Mendlik Date: Fri, 21 Apr 2017 10:10:19 -0600 Subject: [PATCH 2/3] Update tests for compatibility with recent changes Commit 038a51cdc85fe4507eb943bfb16c189538cc144b introduced a change where the sshd_config file is not managed unless the 'sshd_config' pillar variable is defined. The kitchen tests did not define that variable, so they stopped working. This change sets a default value for 'Port' so the file is managed by Salt. --- .kitchen.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 659e471..901710f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -21,6 +21,10 @@ provisioner: '*': - openssh openssh.sls: + sshd_config: + Port: 22 + ssh_config: + Port: 22 openssh: sshd_config_mode: '600' From 7245e1aa32136e2b31b65c3e9d57bcd3ee70d3ae Mon Sep 17 00:00:00 2001 From: Adam Mendlik Date: Fri, 21 Apr 2017 10:18:37 -0600 Subject: [PATCH 3/3] Add kitchen tests for FreeBSD --- .kitchen.yml | 6 ++++++ .../default/serverspec/openssl_server_spec.rb | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 901710f..51f612e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -8,6 +8,12 @@ platforms: - name: ubuntu-14.04 - name: ubuntu-16.04 - name: debian-8.5 + - name: freebsd-10.3 + driver: + cache_directory: false + - name: freebsd-11.0 + driver: + cache_directory: false provisioner: name: salt_solo diff --git a/test/integration/default/serverspec/openssl_server_spec.rb b/test/integration/default/serverspec/openssl_server_spec.rb index 944b10b..62bef04 100644 --- a/test/integration/default/serverspec/openssl_server_spec.rb +++ b/test/integration/default/serverspec/openssl_server_spec.rb @@ -3,8 +3,15 @@ set :backend, :exec def service_name() return case os[:family] - when 'redhat' then 'sshd' when 'debian', 'ubuntu' then 'ssh' + else 'sshd' + end +end + +def root_group() + return case os[:family] + when 'freebsd' then 'wheel' + else 'root' end end @@ -17,13 +24,13 @@ describe 'openssl/config.sls' do describe file('/etc/ssh/sshd_config') do it { should be_mode 600 } it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } + it { should be_grouped_into root_group() } end describe file('/etc/ssh/ssh_config') do it { should be_mode 644 } it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } + it { should be_grouped_into root_group() } end end