Skip to content

Commit 13dbc84

Browse files
Try to use SoloRunner
It should consume less resources and be faster Signed-off-by: Artem Sidorenko <[email protected]>
1 parent 5a2dae3 commit 13dbc84

File tree

4 files changed

+55
-55
lines changed

4 files changed

+55
-55
lines changed

spec/recipes/client_spec.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# converge
2727
cached(:chef_run) do
28-
ChefSpec::ServerRunner.new.converge(described_recipe)
28+
ChefSpec::SoloRunner.new.converge(described_recipe)
2929
end
3030

3131
it 'installs openssh-client' do
@@ -69,7 +69,7 @@
6969

7070
context 'weak_hmac enabled only for the client' do
7171
cached(:chef_run) do
72-
ChefSpec::ServerRunner.new do |node|
72+
ChefSpec::SoloRunner.new do |node|
7373
node.normal['ssh-hardening']['ssh']['client']['weak_hmac'] = true
7474
end.converge(described_recipe)
7575
end
@@ -79,7 +79,7 @@
7979

8080
context 'weak_hmac enabled only for the server' do
8181
cached(:chef_run) do
82-
ChefSpec::ServerRunner.new do |node|
82+
ChefSpec::SoloRunner.new do |node|
8383
node.normal['ssh-hardening']['ssh']['server']['weak_hmac'] = true
8484
end.converge(described_recipe)
8585
end
@@ -89,7 +89,7 @@
8989

9090
context 'weak_kex enabled for the client only' do
9191
cached(:chef_run) do
92-
ChefSpec::ServerRunner.new do |node|
92+
ChefSpec::SoloRunner.new do |node|
9393
node.normal['ssh-hardening']['ssh']['client']['weak_kex'] = true
9494
end.converge(described_recipe)
9595
end
@@ -99,7 +99,7 @@
9999

100100
context 'weak_kexs enabled for the server only' do
101101
cached(:chef_run) do
102-
ChefSpec::ServerRunner.new do |node|
102+
ChefSpec::SoloRunner.new do |node|
103103
node.normal['ssh-hardening']['ssh']['server']['weak_kex'] = true
104104
end.converge(described_recipe)
105105
end
@@ -109,7 +109,7 @@
109109

110110
context 'cbc_required set for the client only' do
111111
cached(:chef_run) do
112-
ChefSpec::ServerRunner.new do |node|
112+
ChefSpec::SoloRunner.new do |node|
113113
node.normal['ssh-hardening']['ssh']['client']['cbc_required'] = true
114114
end.converge(described_recipe)
115115
end
@@ -119,7 +119,7 @@
119119

120120
context 'cbc_required set for the server only' do
121121
cached(:chef_run) do
122-
ChefSpec::ServerRunner.new do |node|
122+
ChefSpec::SoloRunner.new do |node|
123123
node.normal['ssh-hardening']['ssh']['server']['cbc_required'] = true
124124
end.converge(described_recipe)
125125
end
@@ -129,7 +129,7 @@
129129

130130
context 'with custom KEXs' do
131131
cached(:chef_run) do
132-
ChefSpec::ServerRunner.new do |node|
132+
ChefSpec::SoloRunner.new do |node|
133133
node.normal['ssh-hardening']['ssh']['client']['kex'] = 'mycustomkexvalue'
134134
end.converge(described_recipe)
135135
end
@@ -142,7 +142,7 @@
142142

143143
context 'with custom MACs' do
144144
cached(:chef_run) do
145-
ChefSpec::ServerRunner.new do |node|
145+
ChefSpec::SoloRunner.new do |node|
146146
node.normal['ssh-hardening']['ssh']['client']['mac'] = 'mycustommacvalue'
147147
end.converge(described_recipe)
148148
end
@@ -155,7 +155,7 @@
155155

156156
context 'with custom ciphers' do
157157
cached(:chef_run) do
158-
ChefSpec::ServerRunner.new do |node|
158+
ChefSpec::SoloRunner.new do |node|
159159
node.normal['ssh-hardening']['ssh']['client']['cipher'] = 'mycustomciphervalue'
160160
end.converge(described_recipe)
161161
end
@@ -168,7 +168,7 @@
168168

169169
context 'with empty send_env attribute' do
170170
cached(:chef_run) do
171-
ChefSpec::ServerRunner.new do |node|
171+
ChefSpec::SoloRunner.new do |node|
172172
node.normal['ssh-hardening']['ssh']['client']['send_env'] = []
173173
end.converge(described_recipe)
174174
end
@@ -181,7 +181,7 @@
181181

182182
context 'with custom send_env attribute' do
183183
cached(:chef_run) do
184-
ChefSpec::ServerRunner.new do |node|
184+
ChefSpec::SoloRunner.new do |node|
185185
node.normal['ssh-hardening']['ssh']['client']['send_env'] = %w[some environment variables]
186186
end.converge(described_recipe)
187187
end
@@ -195,7 +195,7 @@
195195
describe 'extra configuration values' do
196196
context 'without custom extra config value' do
197197
cached(:chef_run) do
198-
ChefSpec::ServerRunner.new.converge(described_recipe)
198+
ChefSpec::SoloRunner.new.converge(described_recipe)
199199
end
200200

201201
it 'does not have any extra config options' do
@@ -207,7 +207,7 @@
207207

208208
context 'with custom extra config value' do
209209
cached(:chef_run) do
210-
ChefSpec::ServerRunner.new do |node|
210+
ChefSpec::SoloRunner.new do |node|
211211
node.normal['ssh-hardening']['ssh']['client']['extras']['#ExtraConfig'] = 'Value'
212212
end.converge(described_recipe)
213213
end
@@ -229,7 +229,7 @@
229229

230230
context 'running with OpenSSH >= 7.6 on Ubuntu 18.04' do
231231
cached(:chef_run) do
232-
ChefSpec::ServerRunner.new(version: '18.04').converge(described_recipe)
232+
ChefSpec::SoloRunner.new(version: '18.04').converge(described_recipe)
233233
end
234234

235235
it 'should not have RhostsRSAAuthentication and RSAAuthentication' do

spec/recipes/default_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
describe 'ssh-hardening::default' do
2222
# converge
2323
cached(:chef_run) do
24-
ChefSpec::ServerRunner.new.converge(described_recipe)
24+
ChefSpec::SoloRunner.new.converge(described_recipe)
2525
end
2626

2727
before do

0 commit comments

Comments
 (0)