diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-24 09:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-24 09:09:47 +0300 |
commit | e3dc4fc8f5df44ccd33739908bd4df2494cc27cc (patch) | |
tree | 2dd6f21b20665e5533bf527cd15d0650c0ea61e8 /spec/lib/gitlab | |
parent | 201a883bdfaf5dcb73142139cec70c10134f5b2c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/optimistic_locking_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/lib/gitlab/optimistic_locking_spec.rb b/spec/lib/gitlab/optimistic_locking_spec.rb index 1d669573b74..34f197b5ddb 100644 --- a/spec/lib/gitlab/optimistic_locking_spec.rb +++ b/spec/lib/gitlab/optimistic_locking_spec.rb @@ -16,6 +16,19 @@ RSpec.describe Gitlab::OptimisticLocking do describe '#retry_lock' do let(:name) { 'optimistic_locking_spec' } + it 'does not change current_scope', :aggregate_failures do + instance = Class.new { include Gitlab::OptimisticLocking }.new + relation = pipeline.cancelable_statuses + + expected_scope = Ci::Build.current_scope&.to_sql + + instance.send(:retry_lock, relation, name: :test) do + expect(Ci::Build.current_scope&.to_sql).to eq(expected_scope) + end + + expect(Ci::Build.current_scope&.to_sql).to eq(expected_scope) + end + context 'when state changed successfully without retries' do subject do described_class.retry_lock(pipeline, name: name) do |lock_subject| |