Skip to content

Commit

Permalink
Merge pull request #95 from test-kitchen/2.0.0.dev.1
Browse files Browse the repository at this point in the history
2.0.0.dev.1
  • Loading branch information
JJ Asghar committed Sep 10, 2015
2 parents 42f4199 + c523dbd commit d52f5f1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 53 deletions.
16 changes: 1 addition & 15 deletions lib/kitchen/driver/openstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Openstack < Kitchen::Driver::Base # rubocop:disable Metrics/ClassLength, M
default_config :network_ref, nil
default_config :no_ssh_tcp_check, false
default_config :no_ssh_tcp_check_sleep, 120
default_config :winrm_wait, 0
default_config :winrm_wait, nil
default_config :block_device_mapping, nil

required_config :private_key_path
Expand Down Expand Up @@ -341,7 +341,6 @@ def hints_path
end

def setup_ssh(server, state)
tcp_check(state)
if config[:key_name]
info "Using OpenStack keypair <#{config[:key_name]}>"
end
Expand All @@ -364,19 +363,6 @@ def do_ssh_setup(state, config, server)
])
end

def tcp_check(state)
# allow driver config to bypass SSH tcp check -- because
# it doesn't respect ssh_config values that might be required
if config[:no_ssh_tcp_check]
sleep(config[:no_ssh_tcp_check_sleep])
else
wait_for_sshd(state[:hostname],
config[:username],
port: config[:port])
end
info "Server #{state[:hostname]} has ssh ready..."
end

def disable_ssl_validation
require 'excon'
Excon.defaults[:ssl_verify_peer] = false
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/openstack_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ module Kitchen
#
# @author Jonathan Hartman <j@p4nt5.com>
module Driver
OPENSTACK_VERSION = '2.0.0.dev'
OPENSTACK_VERSION = '2.0.0.dev.1'
end
end
38 changes: 1 addition & 37 deletions spec/kitchen/driver/openstack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
allow(d).to receive(:add_ohai_hint).and_return(true)
allow(d).to receive(:do_ssh_setup).and_return(true)
allow(d).to receive(:sleep)
allow(d).to receive(:wait_for_ssh_key_access).and_return('SSH key authetication successful') # rubocop:disable Metrics/LineLength
d
end

Expand Down Expand Up @@ -1104,43 +1105,6 @@
end
end

describe '#setup_ssh' do
let(:server) { double }
before(:each) do
[:tcp_check, :do_ssh_setup].each do |m|
allow_any_instance_of(described_class).to receive(m)
end
end

it 'calls the TCP check' do
expect_any_instance_of(described_class).to receive(:tcp_check).with(state)
driver.send(:setup_ssh, server, state)
end
end

describe '#tcp_check' do
let(:state) { { hostname: 'hostname' } }

context 'standard SSH check' do
it 'calls the normal Kitchen SSH wait' do
expect_any_instance_of(described_class).not_to receive(:sleep)
expect_any_instance_of(described_class).to receive(:wait_for_sshd)
.with('hostname', 'root', port: '22')
driver.send(:tcp_check, state)
end
end

context 'override SSH wait' do
let(:config) { { no_ssh_tcp_check: true } }

it 'sleeps instead of monitoring the SSH port' do
expect_any_instance_of(described_class).not_to receive(:wait_for_sshd)
expect_any_instance_of(described_class).to receive(:sleep).with(120)
driver.send(:tcp_check, state)
end
end
end

describe '#disable_ssl_validation' do
it 'turns off Excon SSL cert validation' do
expect(driver.send(:disable_ssl_validation)).to eq(false)
Expand Down

0 comments on commit d52f5f1

Please sign in to comment.