Skip to content

Commit

Permalink
feat(centos-6): reshape formula and tests for this platform
Browse files Browse the repository at this point in the history
* Close #104
  • Loading branch information
myii committed May 12, 2019
1 parent b0d6aa1 commit a4b1608
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion test/integration/default/controls/packages_spec.rb
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion test/integration/default/controls/services_spec.rb
Original file line number Diff line number Diff line change
@@ -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)]"
Expand All @@ -6,7 +12,7 @@
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
Expand Down

0 comments on commit a4b1608

Please sign in to comment.