Skip to content

Commit a11e70c

Browse files
committed
(spec) add class tests
1 parent ed3782d commit a11e70c

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

spec/classes/core/openvpn_spec.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe 'profile::core::openvpn' do
6+
on_supported_os.each do |os, os_facts|
7+
next unless os =~ %r{almalinux-9-x86_64}
8+
9+
context "on #{os}" do
10+
let(:facts) { os_facts }
11+
12+
context 'with default parameters' do
13+
14+
let(:params) do
15+
{
16+
version: '2.14.2_40b190d8',
17+
cluster: 'vpn.%{::site}.lsst.org',
18+
}
19+
end
20+
21+
it { is_expected.to compile.with_all_deps }
22+
23+
it do
24+
is_expected.to contain_package('openvpn-as').with(
25+
ensure: '2.14.2_40b190d8',
26+
require: 'Yumrepo[as-repo-rhel9]',
27+
)
28+
end
29+
30+
it do
31+
is_expected.to contain_yumrepo('as-repo-rhel9').with(
32+
ensure: 'present',
33+
name: 'openvpn-access-server',
34+
descr: 'OpenVPN Access Server',
35+
baseurl: 'http://as-repository.openvpn.net/as/yum/rhel9/',
36+
gpgkey: 'https://as-repository.openvpn.net/as-repo-public.gpg',
37+
gpgcheck: '1',
38+
enabled: '1',
39+
)
40+
end
41+
42+
it do
43+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/server.crt').with(
44+
ensure: 'link',
45+
)
46+
end
47+
48+
it do
49+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/server.key').with(
50+
ensure: 'link',
51+
)
52+
end
53+
54+
it do
55+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/ca.crt').with(
56+
ensure: 'link',
57+
)
58+
end
59+
60+
it do
61+
is_expected.to contain_exec('restart_openvpn_service').with(
62+
command: '/usr/bin/systemctl restart openvpnas.service',
63+
refreshonly: 'true',
64+
require: 'Package[openvpn-as]',
65+
)
66+
end
67+
end
68+
end
69+
end
70+
end

0 commit comments

Comments
 (0)