Sha256: 3a7fc81d4819f9b01a67e9ad9703652589f606405ef039e917454df76a0cf431

Contents?: true

Size: 569 Bytes

Versions: 10

Compression:

Stored size: 569 Bytes

Contents

require 'test_plugin_helper'

describe ProxyLoadBalancer do
  let(:load_balancer) { ProxyLoadBalancer.new }

  before do
    ProxyAPI::ForemanDynflow::DynflowProxy.any_instance.stubs(:tasks_count).returns(0)
  end

  it 'load balances' do
    proxies = FactoryGirl.create_list(:smart_proxy, 3, :ssh)
    not_yet_seen = proxies.dup

    3.times do
      found = load_balancer.next(proxies)
      not_yet_seen.delete(found)
    end

    not_yet_seen.must_be_empty
  end

  it 'returns nil for if no proxy is available' do
    load_balancer.next([]).must_be_nil
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_remote_execution-0.3.0 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.2.3 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.2.2 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.2.1 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.1.2 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.1.1 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.1.0 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.0.10 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.0.8 test/unit/proxy_load_balancer_test.rb
foreman_remote_execution-0.0.7 test/unit/proxy_load_balancer_test.rb