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
0a2f5065
Commit
0a2f5065
authored
May 14, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we validate Runner#runner_type when persisting RunnerNamespace
parent
ab489d29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
app/models/ci/runner_namespace.rb
app/models/ci/runner_namespace.rb
+1
-1
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+7
-0
No files found.
app/models/ci/runner_namespace.rb
View file @
0a2f5065
...
@@ -2,7 +2,7 @@ module Ci
...
@@ -2,7 +2,7 @@ module Ci
class
RunnerNamespace
<
ActiveRecord
::
Base
class
RunnerNamespace
<
ActiveRecord
::
Base
extend
Gitlab
::
Ci
::
Model
extend
Gitlab
::
Ci
::
Model
belongs_to
:runner
belongs_to
:runner
,
validate:
true
belongs_to
:namespace
,
class_name:
'::Namespace'
belongs_to
:namespace
,
class_name:
'::Namespace'
belongs_to
:group
,
class_name:
'::Group'
,
foreign_key: :namespace_id
belongs_to
:group
,
class_name:
'::Group'
,
foreign_key: :namespace_id
end
end
...
...
spec/models/ci/runner_spec.rb
View file @
0a2f5065
...
@@ -66,6 +66,13 @@ describe Ci::Runner do
...
@@ -66,6 +66,13 @@ describe Ci::Runner do
expect
(
instance_runner
).
not_to
be_valid
expect
(
instance_runner
).
not_to
be_valid
expect
(
instance_runner
.
errors
.
full_messages
).
to
include
(
'Runner cannot assign project to a non-project runner'
)
expect
(
instance_runner
.
errors
.
full_messages
).
to
include
(
'Runner cannot assign project to a non-project runner'
)
end
end
it
'should fail to save a group assigned to a project runner even if the runner is already saved'
do
group_runner
expect
{
create
(
:group
,
runners:
[
project_runner
])
}
.
to
raise_error
(
ActiveRecord
::
RecordInvalid
)
end
end
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