summaryrefslogtreecommitdiff
path: root/spec/controllers/import
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-11-05 15:37:21 -0800
committerStan Hu <stanhu@gmail.com>2018-11-07 11:37:46 -0800
commit5b6d5301d9589b694fea0820a2b6cf165642669b (patch)
tree50a3cfa2afc1b9fb6783cb15d9582d3a429480b0 /spec/controllers/import
parent4068d46078faaa97acbfbe33cc7663db6d1c831a (diff)
downloadgitlab-ce-5b6d5301d9589b694fea0820a2b6cf165642669b.tar.gz
Paginate Bitbucket Server importer projects
To prevent delays in loading the page and reduce memory usage, limit the number of projects shown at 25 per page. Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/50021
Diffstat (limited to 'spec/controllers/import')
-rw-r--r--spec/controllers/import/bitbucket_server_controller_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb
index 5024ef71771..77060fdc3be 100644
--- a/spec/controllers/import/bitbucket_server_controller_spec.rb
+++ b/spec/controllers/import/bitbucket_server_controller_spec.rb
@@ -121,12 +121,19 @@ describe Import::BitbucketServerController do
@repo = double(slug: 'vim', project_key: 'asd', full_name: 'asd/vim', "valid?" => true, project_name: 'asd', browse_url: 'http://test', name: 'vim')
@invalid_repo = double(slug: 'invalid', project_key: 'foobar', full_name: 'asd/foobar', "valid?" => false, browse_url: 'http://bad-repo')
+ @created_repo = double(slug: 'created', project_key: 'existing', full_name: 'group/created', "valid?" => true, browse_url: 'http://existing')
assign_session_tokens
end
it 'assigns repository categories' do
- created_project = create(:project, import_type: 'bitbucket_server', creator_id: user.id, import_source: 'foo/bar', import_status: 'finished')
- expect(client).to receive(:repos).and_return([@repo, @invalid_repo])
+ created_project = create(:project, import_type: 'bitbucket_server', creator_id: user.id, import_status: 'finished', import_source: @created_repo.browse_url)
+ repos = instance_double(BitbucketServer::Collection)
+
+ expect(repos).to receive(:partition).and_return([[@repo, @created_repo], [@invalid_repo]])
+ expect(repos).to receive(:current_page).and_return(1)
+ expect(repos).to receive(:next_page).and_return(2)
+ expect(repos).to receive(:prev_page).and_return(nil)
+ expect(client).to receive(:repos).and_return(repos)
get :status