Last active
March 21, 2019 17:15
-
-
Save fvoges/1d99e8f008927a554093d60d788bce5b to your computer and use it in GitHub Desktop.
Puppet Practitioner Apache rspec-puppet example using pdk convert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe 'apache' do | |
| on_supported_os.each do |os, os_facts| | |
| context "on #{os}" do | |
| let(:facts) { os_facts } | |
| it { is_expected.to compile } | |
| it { | |
| case facts[:osfamily] | |
| when 'Debian' | |
| pkg_name = 'apache2' | |
| svc_name = 'apache2' | |
| when 'RedHat' | |
| pkg_name = 'httpd' | |
| svc_name = 'httpd' | |
| end | |
| should contain_package('apache').with({ | |
| 'ensure' => 'present', | |
| 'name' => pkg_name, | |
| }) | |
| should contain_file('apache_config').with({ | |
| 'ensure' => 'file', | |
| 'source' => "puppet:///modules/apache/#{facts[:osfamily]}.conf", | |
| }) | |
| should contain_service('apache').with({ | |
| 'ensure' => 'running', | |
| 'enable' => 'true', | |
| 'name' => svc_name, | |
| }) | |
| } | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment