-
Notifications
You must be signed in to change notification settings - Fork 9
/
class_spec.rb
84 lines (69 loc) · 2.32 KB
/
class_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require 'spec_helper_acceptance'
describe 'cfssl class:', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
it 'cfssl is expected run successfully' do
pp = "class { 'cfssl': }"
# Apply twice to ensure no errors the second time.
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to match(%r{error}i)
end
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to eq(%r{error}i)
expect(r.exit_code).to be_zero
end
end
before(:each) do
shell 'rm -fv /etc/cfssl/*'
end
context 'ca_manage => true:' do
it 'runs successfully' do
pp = "class { 'cfssl': ca_manage => true }"
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to match(%r{error}i)
end
shell('test -e /etc/cfssl/ca.csr')
shell('test -e /etc/cfssl/ca-csr.json')
shell('test -e /etc/cfssl/ca-key.pem')
shell('test -e /etc/cfssl/ca.pem')
shell('test -e /etc/cfssl/chain.pem')
shell('test -e /etc/cfssl/signing.json')
shell('test -e /etc/cfssl/intermediate-ca.csr')
shell('test -e /etc/cfssl/intermediate-ca-csr.json')
shell('test -e /etc/cfssl/intermediate-ca-key.pem')
shell('test -e /etc/cfssl/intermediate-ca.pem')
shell('test -e /etc/cfssl/intermediate-ca-signed.csr')
shell('test -e /etc/cfssl/intermediate-ca-signed.pem')
end
end
context 'service_ensure => running:' do
it 'starts the service successfully' do
pp = "class { 'cfssl':
ca_manage => true,
service_manage => true,
service_ensure => running,
}"
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to match(%r{error}i)
end
end
end
context 'service_ensure => stopped:' do
it 'stops the service successfully' do
pp = "class { 'cfssl':
ca_manage => true,
service_manage => true,
service_ensure => stopped,
}"
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to match(%r{error}i)
end
end
end
context 'firewall_manage => true:' do
it 'runs successfully' do
pp = "class { 'cfssl': firewall_manage => true }"
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).not_to match(%r{error}i)
end
end
end
end