25
25
packagename = 'ntp'
26
26
end
27
27
28
+ if ( fact ( 'osfamily' ) == 'Solaris' )
29
+ config = '/etc/inet/ntp.conf'
30
+ else
31
+ config = '/etc/ntp.conf'
32
+ end
33
+
28
34
describe "ntp class:" , :unless => UNSUPPORTED_PLATFORMS . include? ( fact ( 'osfamily' ) ) do
29
35
it 'applies successfully' do
30
36
pp = "class { 'ntp': }"
67
73
apply_manifest ( pp , :catch_failures => true )
68
74
end
69
75
70
- describe file ( '/etc/ntp.conf' ) do
76
+ describe file ( " #{ config } " ) do
71
77
it { should be_file }
72
- it { should contain 'testcontent' }
78
+ its ( :content ) { should match 'testcontent' }
73
79
end
74
80
end
75
81
79
85
apply_manifest ( pp , :catch_failures => true )
80
86
end
81
87
82
- describe file ( '/etc/ntp.conf' ) do
88
+ describe file ( " #{ config } " ) do
83
89
it { should be_file }
84
- it { should contain 'driftfile /tmp/driftfile' }
90
+ its ( :content ) { should match 'driftfile /tmp/driftfile' }
85
91
end
86
92
end
87
93
@@ -102,12 +108,12 @@ class { 'ntp':
102
108
apply_manifest ( pp , :catch_failures => true )
103
109
end
104
110
105
- describe file ( '/etc/ntp.conf' ) do
111
+ describe file ( " #{ config } " ) do
106
112
it { should be_file }
107
- it { should contain 'keys /etc/ntp/keys' }
108
- it { should contain 'controlkey /etc/ntp/controlkey' }
109
- it { should contain 'requestkey 1' }
110
- it { should contain 'trustedkey 1 2' }
113
+ its ( :content ) { should match 'keys /etc/ntp/keys' }
114
+ its ( :content ) { should match 'controlkey /etc/ntp/controlkey' }
115
+ its ( :content ) { should match 'requestkey 1' }
116
+ its ( :content ) { should match 'trustedkey 1 2' }
111
117
end
112
118
end
113
119
@@ -139,8 +145,8 @@ class { 'ntp':
139
145
apply_manifest ( pp , :catch_failures => true )
140
146
end
141
147
142
- describe file ( '/etc/ntp.conf' ) do
143
- it { should contain 'tinker panic' }
148
+ describe file ( " #{ config } " ) do
149
+ its ( :content ) { should match 'tinker panic' }
144
150
end
145
151
end
146
152
@@ -154,8 +160,8 @@ class { 'ntp':
154
160
apply_manifest ( pp , :catch_failures => true )
155
161
end
156
162
157
- describe file ( '/etc/ntp.conf' ) do
158
- it { should_not contain 'tinker panic 0' }
163
+ describe file ( " #{ config } " ) do
164
+ its ( :content ) { should_not match 'tinker panic 0' }
159
165
end
160
166
end
161
167
@@ -165,9 +171,9 @@ class { 'ntp':
165
171
apply_manifest ( pp , :catch_failures => true )
166
172
end
167
173
168
- describe file ( '/etc/ntp.conf' ) do
174
+ describe file ( " #{ config } " ) do
169
175
it { should be_file }
170
- it { should contain '127.127.1.0' }
176
+ its ( :content ) { should match '127.127.1.0' }
171
177
end
172
178
end
173
179
0 commit comments