BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cd834b46
Commit
cd834b46
authored
May 10, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Ci::Runner#assign_to errors for group runners
parent
84fa0610
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
runner.rb
app/models/ci/runner.rb
+2
-0
runner_spec.rb
spec/models/ci/runner_spec.rb
+20
-7
No files found.
app/models/ci/runner.rb
View file @
cd834b46
...
...
@@ -111,6 +111,8 @@ module Ci
if
shared?
self
.
is_shared
=
false
if
shared?
self
.
runner_type
=
:project_type
elsif
group_type?
raise
ArgumentError
,
'Transitioning a group runner to a project runner is not supported'
end
self
.
save
...
...
spec/models/ci/runner_spec.rb
View file @
cd834b46
...
...
@@ -200,16 +200,29 @@ describe Ci::Runner do
describe
'#assign_to'
do
let!
(
:project
)
{
FactoryBot
.
create
(
:project
)
}
let!
(
:shared_runner
)
{
FactoryBot
.
create
(
:ci_runner
,
:shared
)
}
before
do
shared_runner
.
assign_to
(
project
)
subject
{
runner
.
assign_to
(
project
)
}
context
'with shared_runner'
do
let!
(
:runner
)
{
FactoryBot
.
create
(
:ci_runner
,
:shared
)
}
it
'transitions shared runner to project runner and assigns project'
do
subject
expect
(
runner
).
to
be_specific
expect
(
runner
).
to
be_project_type
expect
(
runner
.
projects
).
to
eq
([
project
])
expect
(
runner
.
only_for?
(
project
)).
to
be_truthy
end
end
it
{
expect
(
shared_runner
).
to
be_specific
}
it
{
expect
(
shared_runner
).
to
be_project_type
}
it
{
expect
(
shared_runner
.
projects
).
to
eq
([
project
])
}
it
{
expect
(
shared_runner
.
only_for?
(
project
)).
to
be_truthy
}
context
'with group runner'
do
let!
(
:runner
)
{
FactoryBot
.
create
(
:ci_runner
,
runner_type: :group_type
)
}
it
'raises an error'
do
expect
{
subject
}
.
to
raise_error
(
ArgumentError
,
'Transitioning a group runner to a project runner is not supported'
)
end
end
end
describe
'.online'
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