def wait_for_vm(instance_group_name, index, timeout_seconds, options = {deployment_name: Deployments::DEFAULT_DEPLOYMENT_NAME})
      start_time = Time.now
      loop do
        vm = instances(options).detect { |vm| !vm.vm_cid.empty? && vm.instance_group_name == instance_group_name && vm.index == index && vm.last_known_state != 'unresponsive agent' && vm.last_known_state != nil }
        return vm if vm
        break if Time.now - start_time >= timeout_seconds
        sleep(1)
      end

      @logger.info("Did not find VM after waiting for #{timeout_seconds}")
      nil
    end
def wait_for_vm(instance_group_name, index, timeout_seconds, options = {deployment_name: Deployments::DEFAULT_DEPLOYMENT_NAME})
      start_time = Time.now
      loop do
        vm = instances(options).detect { |vm| !vm.vm_cid.empty? && vm.instance_group_name == instance_group_name && vm.index == index && vm.last_known_state != 'unresponsive agent' && vm.last_known_state != nil }
        return vm if vm
        break if Time.now - start_time >= timeout_seconds
        sleep(1)
      end

      @logger.info("Did not find VM after waiting for #{timeout_seconds}")
      nil
    end
wait_for_vm either returns a vm or nil after waiting for X seconds
 (Do not add default timeout value to be more explicit in tests)