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
161a142b
Commit
161a142b
authored
Jun 06, 2018
by
Alexis Reigel
Committed by
Winnie Hellmann
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add offline scope to Ci::Runner
(cherry picked from commit
00647b31
)
parent
26ba504e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
app/models/ci/runner.rb
app/models/ci/runner.rb
+1
-0
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+12
-1
No files found.
app/models/ci/runner.rb
View file @
161a142b
...
...
@@ -30,6 +30,7 @@ module Ci
scope
:active
,
->
{
where
(
active:
true
)
}
scope
:paused
,
->
{
where
(
active:
false
)
}
scope
:online
,
->
{
where
(
'contacted_at > ?'
,
contact_time_deadline
)
}
scope
:offline
,
->
{
where
.
not
(
id:
online
)
}
scope
:ordered
,
->
{
order
(
id: :desc
)
}
# BACKWARD COMPATIBILITY: There are needed to maintain compatibility with `AVAILABLE_SCOPES` used by `lib/api/runners.rb`
...
...
spec/models/ci/runner_spec.rb
View file @
161a142b
...
...
@@ -223,7 +223,7 @@ describe Ci::Runner do
subject
{
described_class
.
online
}
before
do
@runner1
=
create
(
:ci_runner
,
:instance
,
contacted_at:
1
.
yea
r
.
ago
)
@runner1
=
create
(
:ci_runner
,
:instance
,
contacted_at:
1
.
hou
r
.
ago
)
@runner2
=
create
(
:ci_runner
,
:instance
,
contacted_at:
1
.
second
.
ago
)
end
...
...
@@ -300,6 +300,17 @@ describe Ci::Runner do
end
end
describe
'.offline'
do
subject
{
described_class
.
offline
}
before
do
@runner1
=
create
(
:ci_runner
,
:instance
,
contacted_at:
1
.
hour
.
ago
)
@runner2
=
create
(
:ci_runner
,
:instance
,
contacted_at:
1
.
second
.
ago
)
end
it
{
is_expected
.
to
eq
([
@runner1
])}
end
describe
'#can_pick?'
do
set
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
...
...
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