Sha256: a877343e32a3652a290eb98859deee8d8a8978ad25bb0a99d26f4cbf7eeae0af

Contents?: true

Size: 406 Bytes

Versions: 7

Compression:

Stored size: 406 Bytes

Contents

require 'timeout'

def search_for_nodes(query, timeout = 120)
  nodes = []
  Timeout.timeout(timeout) do
    nodes = search(:node, query)
    until nodes.count > 0 && nodes[0].key?('ipaddress')
      sleep 5
      nodes = search(:node, query)
    end
  end

  if nodes.count == 0 || !nodes[0].key?('ipaddress')
    fail "Unable to find any nodes meeting the search criteria '#{query}'!"
  end

  nodes
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kitchen-nodes-0.6.4 test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.6.4.dev test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.6.3 test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.6.2 test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.6.1 test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.6.0 test/integration/cookbooks/node-tests/libraries/helper.rb
kitchen-nodes-0.5.0 test/integration/cookbooks/node-tests/libraries/helper.rb