Skip to content

Commit 8d7e907

Browse files
test: different python version on rhel8
fix: linter test: fix new version require secret_key parameter test: limit test of python versions to RHEL8
1 parent 3610b53 commit 8d7e907

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

metadata.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
"20.04",
5858
"22.04"
5959
]
60+
},
61+
{
62+
"operatingsystem": "RedHat",
63+
"operatingsystemrelease": [
64+
"8"
65+
]
6066
}
6167
],
6268
"requirements": [

spec/classes/apache/vhost_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,46 @@
4646
'ensure' => 'file'
4747
)
4848
end
49+
50+
if ['RedHat'].include?(facts[:os]['family']) && facts[:os]['release']['major'] == '8'
51+
['3.6', '3.8', '3.9'].each do |python_version|
52+
context "with python_versions #{python_version}" do
53+
let(:pre_condition) do
54+
[
55+
"class { 'puppetboard':
56+
python_version => \"#{python_version}\",
57+
secret_key => 'this_should_be_a_long_secret_string',
58+
}"
59+
]
60+
end
61+
62+
case python_version
63+
when '3.6'
64+
package_name = 'python3-mod_wsgi'
65+
when '3.8'
66+
package_name = 'python38-mod_wsgi'
67+
when '3.9'
68+
package_name = 'python39-mod_wsgi'
69+
end
70+
71+
it { is_expected.to contain_class('apache::mod::wsgi').with(package_name: package_name) }
72+
end
73+
end
74+
75+
context 'with unsupported python_versions' do
76+
let(:pre_condition) do
77+
[
78+
"class { 'puppetboard':
79+
python_version => '3.7',
80+
secret_key => 'this_should_be_a_long_secret_string',
81+
}
82+
"
83+
]
84+
end
85+
86+
it { is_expected.to raise_error(Puppet::Error, %r{python version not supported}) }
87+
end
88+
end
4989
end
5090
end
5191
end

0 commit comments

Comments
 (0)