Commit a3f3b243 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'bvl-isolate-fork-network-background-migrations-ee' into 'master'

(EE-port) Isolate the fork network background migrations

See merge request gitlab-org/gitlab-ee!3395
parents 1c06c91d 8677ad7b
......@@ -3,12 +3,9 @@ require 'spec_helper'
describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, schema: 20170929131201 do
let(:migration) { described_class.new }
let(:base1) { create(:project) }
let(:base1_fork1) { create(:project) }
let(:base1_fork2) { create(:project) }
let(:base2) { create(:project) }
let(:base2_fork1) { create(:project) }
let(:base2_fork2) { create(:project) }
let!(:forked_project_links) { table(:forked_project_links) }
let!(:fork_networks) { table(:fork_networks) }
......@@ -21,21 +18,24 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
# A normal fork link
forked_project_links.create(id: 1,
forked_from_project_id: base1.id,
forked_to_project_id: base1_fork1.id)
forked_to_project_id: create(:project).id)
forked_project_links.create(id: 2,
forked_from_project_id: base1.id,
forked_to_project_id: base1_fork2.id)
forked_to_project_id: create(:project).id)
forked_project_links.create(id: 3,
forked_from_project_id: base2.id,
forked_to_project_id: base2_fork1.id)
# create a fork of a fork
forked_project_links.create(id: 4,
forked_from_project_id: base2_fork1.id,
forked_to_project_id: create(:project).id)
forked_project_links.create(id: 5,
forked_from_project_id: base2.id,
forked_to_project_id: base2_fork2.id)
forked_from_project_id: create(:project).id,
forked_to_project_id: create(:project).id)
# Stub out the calls to the other migrations
allow(BackgroundMigrationWorker).to receive(:perform_in)
migration.perform(1, 3)
end
......@@ -80,7 +80,11 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
end
it 'only processes a single batch of links at a time' do
expect(fork_network_members.count).to eq(5)
expect(fork_networks.count).to eq(2)
migration.perform(3, 5)
expect(fork_networks.count).to eq(3)
end
it 'can be repeated without effect' do
......
......@@ -107,6 +107,15 @@ describe 'OpenID Connect requests' do
end
end
# These 2 calls shouldn't actually throw, they should be handled as an
# unauthorized request, so we should be able to check the response.
#
# This was not possible due to an issue with Warden:
# https://github.com/hassox/warden/pull/162
#
# When the patch gets merged and we update Warden, these specs will need to
# updated to check the response instead of a raised exception.
# https://gitlab.com/gitlab-org/gitlab-ce/issues/40218
context 'when user is blocked' do
it 'returns authentication error' do
access_grant
......@@ -114,7 +123,7 @@ describe 'OpenID Connect requests' do
expect do
request_access_token
end.to throw_symbol :warden
end.to raise_error UncaughtThrowError
end
end
......@@ -125,7 +134,7 @@ describe 'OpenID Connect requests' do
expect do
request_access_token
end.to throw_symbol :warden
end.to raise_error UncaughtThrowError
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment