Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a9336c02
Commit
a9336c02
authored
Sep 08, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reproduction test for expected bug behavior
This reproduces the consistent ordering bug behavior.
parent
38acdb33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
spec/workers/issue_placement_worker_spec.rb
spec/workers/issue_placement_worker_spec.rb
+29
-8
No files found.
spec/workers/issue_placement_worker_spec.rb
View file @
a9336c02
...
...
@@ -37,12 +37,18 @@ RSpec.describe IssuePlacementWorker do
described_class
.
new
.
perform
(
issue
.
id
)
end
it
'limits the sweep to QUERY_LIMIT records, and reschedules placement'
do
context
'there are more than QUERY_LIMIT unplaced issues'
do
let_it_be
(
:unplaced
)
do
# Ensure there are more than N issues in this set
n
=
described_class
::
QUERY_LIMIT
create_list
(
:issue
,
n
-
5
,
**
unplaced
)
end
it
'limits the sweep to QUERY_LIMIT records, and reschedules placement'
do
expect
(
Issue
).
to
receive
(
:move_nulls_to_end
)
.
with
(
have_attributes
(
count:
described_class
::
QUERY_LIMIT
))
.
and_call_original
expect
(
Issue
).
to
receive
(
:move_nulls_to_end
).
with
(
have_attributes
(
count:
n
)).
and_call_original
expect
(
described_class
).
to
receive
(
:perform_async
).
with
(
issue_d
.
id
)
described_class
.
new
.
perform
(
issue
.
id
)
...
...
@@ -50,6 +56,21 @@ RSpec.describe IssuePlacementWorker do
expect
(
project
.
issues
.
where
(
relative_position:
nil
)).
to
exist
end
it
'is eventually correct'
do
prefix
=
project
.
issues
.
where
.
not
(
relative_position:
nil
).
order
(
:relative_position
).
to_a
moved
=
project
.
issues
.
where
.
not
(
id:
prefix
.
map
(
&
:id
))
described_class
.
new
.
perform
(
issue
.
id
)
expect
(
project
.
issues
.
where
(
relative_position:
nil
)).
to
exist
described_class
.
new
.
perform
(
issue
.
id
)
expect
(
project
.
issues
.
where
(
relative_position:
nil
)).
not_to
exist
expect
(
project
.
issues
.
order
(
:relative_position
)).
to
eq
(
prefix
+
moved
.
order
(
:created_at
,
:id
))
end
end
it
'anticipates the failure to find the issue'
do
id
=
non_existing_record_id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment