diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/models/concerns | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/atomic_internal_id_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/concerns/from_union_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/concerns/optionally_search_spec.rb | 2 |
3 files changed, 18 insertions, 10 deletions
diff --git a/spec/models/concerns/atomic_internal_id_spec.rb b/spec/models/concerns/atomic_internal_id_spec.rb index 8c3537f1dcc..5ee3c012dc9 100644 --- a/spec/models/concerns/atomic_internal_id_spec.rb +++ b/spec/models/concerns/atomic_internal_id_spec.rb @@ -86,4 +86,20 @@ RSpec.describe AtomicInternalId do expect { subject }.to change { milestone.iid }.from(nil).to(iid.to_i) end end + + describe '.with_project_iid_supply' do + let(:iid) { 100 } + + it 'wraps generate and track_greatest in a concurrency-safe lock' do + expect_next_instance_of(InternalId::InternalIdGenerator) do |g| + expect(g).to receive(:with_lock).and_call_original + expect(g.record).to receive(:last_value).and_return(iid) + expect(g).to receive(:track_greatest).with(iid + 4) + end + + ::Milestone.with_project_iid_supply(milestone.project) do |supply| + 4.times { supply.next_value } + end + end + end end diff --git a/spec/models/concerns/from_union_spec.rb b/spec/models/concerns/from_union_spec.rb index bd2893090a8..4f4d948fe48 100644 --- a/spec/models/concerns/from_union_spec.rb +++ b/spec/models/concerns/from_union_spec.rb @@ -3,13 +3,5 @@ require 'spec_helper' RSpec.describe FromUnion do - [true, false].each do |sql_set_operator| - context "when sql-set-operators feature flag is #{sql_set_operator}" do - before do - stub_feature_flags(sql_set_operators: sql_set_operator) - end - - it_behaves_like 'from set operator', Gitlab::SQL::Union - end - end + it_behaves_like 'from set operator', Gitlab::SQL::Union end diff --git a/spec/models/concerns/optionally_search_spec.rb b/spec/models/concerns/optionally_search_spec.rb index c8e2e6da51f..8067ad50322 100644 --- a/spec/models/concerns/optionally_search_spec.rb +++ b/spec/models/concerns/optionally_search_spec.rb @@ -32,7 +32,7 @@ RSpec.describe OptionallySearch do it 'delegates to the search method' do expect(model) .to receive(:search) - .with('foo', {}) + .with('foo') .and_call_original expect(model.optionally_search('foo')).to eq(['foo', {}]) |