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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
9ab02540
Commit
9ab02540
authored
Oct 11, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make "merge ongoing" check more consistent
parent
efeaf3bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
changelogs/unreleased/39032-improve-merge-ongoing-check-consistency.yml
...eleased/39032-improve-merge-ongoing-check-consistency.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+21
-1
No files found.
app/models/merge_request.rb
View file @
9ab02540
...
@@ -396,7 +396,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -396,7 +396,7 @@ class MergeRequest < ActiveRecord::Base
end
end
def
merge_ongoing?
def
merge_ongoing?
!!
merge_jid
&&
!
merged?
!!
merge_jid
&&
!
merged?
&&
Gitlab
::
SidekiqStatus
.
num_running
([
merge_jid
])
>
0
end
end
def
closed_without_fork?
def
closed_without_fork?
...
...
changelogs/unreleased/39032-improve-merge-ongoing-check-consistency.yml
0 → 100644
View file @
9ab02540
---
title
:
Make "merge ongoing" check more consistent
merge_request
:
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
9ab02540
...
@@ -1460,11 +1460,31 @@ describe MergeRequest do
...
@@ -1460,11 +1460,31 @@ describe MergeRequest do
end
end
describe
'#merge_ongoing?'
do
describe
'#merge_ongoing?'
do
it
'returns true when merge_id
is present and MR is not merged
'
do
it
'returns true when merge_id
, MR is not merged and it has no running job
'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
'foo'
)
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
'foo'
)
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:num_running
).
with
([
'foo'
])
{
1
}
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
true
)
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
true
)
end
end
it
'returns false when merge_jid is nil'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
nil
)
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
it
'returns false if MR is merged'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :merged
,
merge_jid:
'foo'
)
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
it
'returns false if there is no merge job running'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
'foo'
)
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:num_running
).
with
([
'foo'
])
{
0
}
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
end
end
describe
"#closed_without_fork?"
do
describe
"#closed_without_fork?"
do
...
...
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