Skip to content

Commit

Permalink
Merge pull request #212 from artem-forks/tests
Browse files Browse the repository at this point in the history
Tests: try to use SoloRunner instead of ServerRunner
  • Loading branch information
artem-sidorenko committed Jul 16, 2019
2 parents 2c5fab1 + 5624b63 commit f362e2c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 55 deletions.
30 changes: 15 additions & 15 deletions spec/recipes/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# converge
cached(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

it 'installs openssh-client' do
Expand Down Expand Up @@ -69,7 +69,7 @@

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

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

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

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

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

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

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

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

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

context 'with empty send_env attribute' do
cached(:chef_run) do
ChefSpec::ServerRunner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.normal['ssh-hardening']['ssh']['client']['send_env'] = []
end.converge(described_recipe)
end
Expand All @@ -181,7 +181,7 @@

context 'with custom send_env attribute' do
cached(:chef_run) do
ChefSpec::ServerRunner.new do |node|
ChefSpec::SoloRunner.new do |node|
node.normal['ssh-hardening']['ssh']['client']['send_env'] = %w[some environment variables]
end.converge(described_recipe)
end
Expand All @@ -195,7 +195,7 @@
describe 'extra configuration values' do
context 'without custom extra config value' do
cached(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

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

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

context 'running with OpenSSH >= 7.6 on Ubuntu 18.04' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(version: '18.04').converge(described_recipe)
ChefSpec::SoloRunner.new(version: '18.04').converge(described_recipe)
end

it 'should not have RhostsRSAAuthentication and RSAAuthentication' do
Expand Down
2 changes: 1 addition & 1 deletion spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
describe 'ssh-hardening::default' do
# converge
cached(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
ChefSpec::SoloRunner.new.converge(described_recipe)
end

before do
Expand Down
Loading

0 comments on commit f362e2c

Please sign in to comment.