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:
Diffstat (limited to 'spec/models/concerns/atomic_internal_id_spec.rb')
-rw-r--r--spec/models/concerns/atomic_internal_id_spec.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/models/concerns/atomic_internal_id_spec.rb b/spec/models/concerns/atomic_internal_id_spec.rb
index 35b0f107676..b803e699b25 100644
--- a/spec/models/concerns/atomic_internal_id_spec.rb
+++ b/spec/models/concerns/atomic_internal_id_spec.rb
@@ -240,18 +240,12 @@ RSpec.describe AtomicInternalId do
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
+ it 'supplies a stream of iid values' do
+ expect do
+ ::Milestone.with_project_iid_supply(milestone.project) do |supply|
+ 4.times { supply.next_value }
+ end
+ end.to change { InternalId.find_by(project: milestone.project, usage: :milestones)&.last_value.to_i }.by(4)
end
end
end