Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-16 00:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-16 00:09:09 +0300
commitd1377e82d9bccd6b49c08aa67f6776b7981295ae (patch)
tree0a02a1b531d6e8097efc11468303bffbd0f18af5 /spec/workers/authorized_project_update
parentd811b6d8f61b45cd12f94251abff9102b8cefc19 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/authorized_project_update')
-rw-r--r--spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb
index 671269de519..c27629c3a15 100644
--- a/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb
+++ b/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb
@@ -12,9 +12,9 @@ RSpec.describe AuthorizedProjectUpdate::UserRefreshFromReplicaWorker do
expect(described_class.get_urgency).to eq(:low)
end
- it_behaves_like 'worker with data consistency',
- described_class,
- data_consistency: :delayed
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { user.id }
+ end
describe '#perform' do
it 'checks if a project_authorization refresh is needed for the user' do
@@ -44,22 +44,21 @@ RSpec.describe AuthorizedProjectUpdate::UserRefreshFromReplicaWorker do
end
end
- context 'when the feature flag `user_refresh_from_replica_worker_uses_replica_db` is disabled' do
+ context 'with load balancing enabled' do
before do
- stub_feature_flags(user_refresh_from_replica_worker_uses_replica_db: false)
+ allow(Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true)
end
- context 'when load balancing is enabled' do
- before do
- allow(Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true)
- end
+ it 'reads from the replica database' do
+ expect(Gitlab::Database::LoadBalancing::Session.current).to receive(:use_replicas_for_read_queries).and_call_original
- it 'reads from the primary database' do
- expect(Gitlab::Database::LoadBalancing::Session.current)
- .to receive(:use_primary!)
+ execute_worker
+ end
+ end
- execute_worker
- end
+ context 'when the feature flag `user_refresh_from_replica_worker_uses_replica_db` is disabled' do
+ before do
+ stub_feature_flags(user_refresh_from_replica_worker_uses_replica_db: false)
end
it 'calls Users::RefreshAuthorizedProjectsService' do