feat(centos-6): reshape formula and tests for this platform

* Close #104
This commit is contained in:
Imran Iqbal 2019-05-08 20:50:47 +01:00
parent b0d6aa1f8c
commit a4b1608ab4
No known key found for this signature in database
GPG key ID: 6D8629439D2B7819
5 changed files with 23 additions and 5 deletions

View file

@ -34,7 +34,7 @@ env:
- INSTANCE: default-debian-8-2017-7-py2
- INSTANCE: default-ubuntu-1604-2017-7-py2
# TODO: Enable after improving the formula to work with other than `systemd`
# - INSTANCE: default-centos-6-2017-7-py2
- INSTANCE: default-centos-6-2017-7-py2
- INSTANCE: default-fedora-28-2017-7-py2
- INSTANCE: default-opensuse-leap-42-2017-7-py2

View file

@ -64,7 +64,7 @@ platforms:
- name: centos-6-2017-7-py2
driver:
image: netmanagers/salt-2017.7-py2:centos-6
run_options: '--entrypoint /sbin/init'
run_command: /sbin/init
- name: fedora-28-2017-7-py2
driver:
image: netmanagers/salt-2017.7-py2:fedora-28

View file

@ -8,10 +8,16 @@ template:
# Using bash package and udev service as an example. This allows us to
# test the template formula itself. You should set these parameters to
# examples that make sense in the contexto of the formula you're writing.
{%- if grains.osfinger == 'CentOS-6' %}
pkg: cronie
service:
name: crond
{%- else %}
pkg: bash
config: /etc/template-formula.conf
service:
name: systemd-udevd
{%- endif %}
config: /etc/template-formula.conf
tofs:
# The files_switch key serves as a selector for alternative

View file

@ -1,7 +1,13 @@
# Overide by OS
package_name = 'bash'
if os[:name] == 'centos' and os[:release].start_with?('6')
package_name = 'cronie'
end
control 'Template package' do
title 'should be installed'
describe package('bash') do
describe package(package_name) do
it { should be_installed }
end
end

View file

@ -1,3 +1,9 @@
# Overide by OS
service_name = 'systemd-udevd'
if os[:name] == 'centos' and os[:release].start_with?('6')
service_name = 'crond'
end
# Temporary `if` due to `opensuse-leap-15` bug re: `service`
if os[:name] == 'suse'
puts "[Skip `service`-based tests due to `opensuse-leap-15` detection bug (see https://github.com/inspec/train/issues/377)]"
@ -6,7 +12,7 @@ control 'Template service' do
impact 0.5
title 'should be running and enabled'
describe service('systemd-udevd') do
describe service(service_name) do
it { should be_enabled }
it { should be_running }
end