diff options
Diffstat (limited to 'spec/lib/gitlab/github_import/client_pool_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/client_pool_spec.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/spec/lib/gitlab/github_import/client_pool_spec.rb b/spec/lib/gitlab/github_import/client_pool_spec.rb deleted file mode 100644 index aabb47c2cf1..00000000000 --- a/spec/lib/gitlab/github_import/client_pool_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::GithubImport::ClientPool, feature_category: :importers do - subject(:pool) { described_class.new(token_pool: %w[foo bar], per_page: 1, parallel: true) } - - describe '#best_client' do - it 'returns the client with the most remaining requests' do - allow(Gitlab::GithubImport::Client).to receive(:new).and_return( - instance_double( - Gitlab::GithubImport::Client, - requests_remaining?: true, remaining_requests: 10, rate_limit_resets_in: 1 - ), - instance_double( - Gitlab::GithubImport::Client, - requests_remaining?: true, remaining_requests: 20, rate_limit_resets_in: 2 - ) - ) - - expect(pool.best_client.remaining_requests).to eq(20) - end - - context 'when all clients are rate limited' do - it 'returns the client with the closest rate limit reset time' do - allow(Gitlab::GithubImport::Client).to receive(:new).and_return( - instance_double( - Gitlab::GithubImport::Client, - requests_remaining?: false, remaining_requests: 10, rate_limit_resets_in: 10 - ), - instance_double( - Gitlab::GithubImport::Client, - requests_remaining?: false, remaining_requests: 20, rate_limit_resets_in: 20 - ) - ) - - expect(pool.best_client.rate_limit_resets_in).to eq(10) - end - end - end -end |