Merge pull request #130 from sschneid/check_ssh_before_marking_ready

(QENG-2952) Check that SSH is available
This commit is contained in:
Colin 2015-09-17 11:58:44 -07:00
commit 6395d0227e
2 changed files with 12 additions and 0 deletions

View file

@ -31,6 +31,14 @@ module Vmpooler
host = $vsphere[pool].find_vm(vm)
if host
begin
Timeout.timeout(5) do
TCPSocket.new vm, 22
end
rescue
fail_pending_vm(vm, pool, timeout)
end
move_pending_vm_to_ready(vm, pool, host)
else
fail_pending_vm(vm, pool, timeout)

View file

@ -35,10 +35,14 @@ describe 'Pool Manager' do
context 'host is in pool' do
let(:vm_finder) { double('vm_finder') }
let(:tcpsocket) { double('TCPSocket') }
it 'calls move_pending_vm_to_ready' do
stub_const("TCPSocket", tcpsocket)
allow(pool_helper).to receive(:find_vm).and_return(vm_finder)
allow(vm_finder).to receive(:summary).and_return(nil)
allow(tcpsocket).to receive(:new).and_return(true)
expect(vm_finder).to receive(:summary).once
expect(redis).not_to receive(:hget).with(String, 'clone')