Skip to content

Commit 6daa69c

Browse files
committed
(spec) add class tests
1 parent f7ef83b commit 6daa69c

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

spec/classes/core/openvpn_spec.rb

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
let(:params) do
14+
{
15+
version: '2.14.2_40b190d8',
16+
cluster: 'vpn.%{::site}.lsst.org',
17+
}
18+
end
19+
20+
it { is_expected.to compile.with_all_deps }
21+
22+
it do
23+
is_expected.to contain_package('openvpn-as').with(
24+
ensure: '2.14.2_40b190d8',
25+
require: 'Yumrepo[as-repo-rhel9]'
26+
)
27+
end
28+
29+
it do
30+
is_expected.to contain_yumrepo('as-repo-rhel9').with(
31+
ensure: 'present',
32+
name: 'openvpn-access-server',
33+
descr: 'OpenVPN Access Server',
34+
baseurl: 'http://as-repository.openvpn.net/as/yum/rhel9/',
35+
gpgkey: 'https://as-repository.openvpn.net/as-repo-public.gpg',
36+
gpgcheck: '1',
37+
enabled: '1'
38+
)
39+
end
40+
41+
it do
42+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/server.crt').with(
43+
ensure: 'link'
44+
)
45+
end
46+
47+
it do
48+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/server.key').with(
49+
ensure: 'link'
50+
)
51+
end
52+
53+
it do
54+
is_expected.to contain_file('/usr/local/openvpn_as/etc/web-ssl/ca.crt').with(
55+
ensure: 'link'
56+
)
57+
end
58+
59+
it do
60+
is_expected.to contain_exec('restart_openvpn_service').with(
61+
command: '/usr/bin/systemctl restart openvpnas.service',
62+
refreshonly: 'true',
63+
require: 'Package[openvpn-as]'
64+
)
65+
end
66+
end
67+
end
68+
end
69+
end

0 commit comments

Comments
 (0)