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
65d1adb6
Commit
65d1adb6
authored
Mar 24, 2021
by
Furkan Ayhan
Committed by
Lin Jen-Shin
Mar 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix update-older-statuses query
It was wrongly trying to update all statuses
parent
d48de25d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app/models/commit_status.rb
app/models/commit_status.rb
+2
-1
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+19
-0
No files found.
app/models/commit_status.rb
View file @
65d1adb6
...
...
@@ -293,7 +293,8 @@ class CommitStatus < ApplicationRecord
end
def
update_older_statuses_retried!
self
.
class
pipeline
.
statuses
.
latest
.
where
(
name:
name
)
.
where
.
not
(
id:
id
)
...
...
spec/models/commit_status_spec.rb
View file @
65d1adb6
...
...
@@ -870,4 +870,23 @@ RSpec.describe CommitStatus do
it
{
is_expected
.
to
eq
(
false
)
}
end
end
describe
'#update_older_statuses_retried!'
do
let!
(
:build_old
)
{
create_status
(
name:
'build'
)
}
let!
(
:build_new
)
{
create_status
(
name:
'build'
)
}
let!
(
:test
)
{
create_status
(
name:
'test'
)
}
let!
(
:build_from_other_pipeline
)
do
new_pipeline
=
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
create_status
(
name:
'build'
,
pipeline:
new_pipeline
)
end
it
"updates 'retried' and 'status' columns of the latest status with the same name in the same pipeline"
do
build_new
.
update_older_statuses_retried!
expect
(
build_new
.
reload
).
to
have_attributes
(
retried:
false
,
processed:
false
)
expect
(
build_old
.
reload
).
to
have_attributes
(
retried:
true
,
processed:
true
)
expect
(
test
.
reload
).
to
have_attributes
(
retried:
false
,
processed:
false
)
expect
(
build_from_other_pipeline
.
reload
).
to
have_attributes
(
retried:
false
,
processed:
false
)
end
end
end
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