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
a68bcce7
Commit
a68bcce7
authored
Jun 17, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix JenkinsService test button
Closes #637
parent
7b612762
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
+29
-12
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/models/project_services/jenkins_service.rb
app/models/project_services/jenkins_service.rb
+3
-4
spec/models/project_services/jenkins_service_spec.rb
spec/models/project_services/jenkins_service_spec.rb
+25
-8
No files found.
CHANGELOG-EE
View file @
a68bcce7
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.9.0 (unreleased)
v 8.9.0 (unreleased)
- Fix JenkinsService test button
- Fix nil user handling in UpdateMirrorService
- Fix nil user handling in UpdateMirrorService
- Allow LDAP to mark users as external based on their group membership. !432
- Allow LDAP to mark users as external based on their group membership. !432
- Forbid MR authors from approving their own MRs
- Forbid MR authors from approving their own MRs
...
...
app/models/project_services/jenkins_service.rb
View file @
a68bcce7
...
@@ -53,14 +53,13 @@ class JenkinsService < CiService
...
@@ -53,14 +53,13 @@ class JenkinsService < CiService
def
test
(
data
)
def
test
(
data
)
begin
begin
result
=
execute
(
data
)
code
,
message
=
execute
(
data
)
message
=
result
.
message
||
result
unless
result
.
nil?
return
{
success:
false
,
result:
message
}
if
code
!=
200
return
{
success:
false
,
result:
message
}
if
result
.
code
!=
200
rescue
StandardError
=>
error
rescue
StandardError
=>
error
return
{
success:
false
,
result:
error
}
return
{
success:
false
,
result:
error
}
end
end
{
success:
true
,
result:
result
}
{
success:
true
,
result:
message
}
end
end
def
auth
def
auth
...
...
spec/models/project_services/jenkins_service_spec.rb
View file @
a68bcce7
...
@@ -25,6 +25,16 @@ describe JenkinsService do
...
@@ -25,6 +25,16 @@ describe JenkinsService do
it
{
is_expected
.
to
have_one
:service_hook
}
it
{
is_expected
.
to
have_one
:service_hook
}
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:jenkins_params
)
do
{
active:
true
,
project:
project
,
properties:
{
jenkins_url:
'http://jenkins.example.com/'
,
project_name:
'my_project'
}
}
end
describe
'username validation'
do
describe
'username validation'
do
before
do
before
do
...
@@ -74,19 +84,26 @@ describe JenkinsService do
...
@@ -74,19 +84,26 @@ describe JenkinsService do
end
end
end
end
describe
'#test'
do
it
'returns the right status'
do
user
=
create
(
:user
,
username:
'username'
)
project
=
create
(
:project
,
name:
'project'
)
push_sample_data
=
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
jenkins_service
=
described_class
.
create
(
jenkins_params
)
stub_request
(
:post
,
jenkins_service
.
hook_url
)
result
=
jenkins_service
.
test
(
push_sample_data
)
expect
(
result
).
to
eq
({
success:
true
,
result:
''
})
end
end
describe
'#execute'
do
describe
'#execute'
do
it
'adds default web hook headers to the request'
do
it
'adds default web hook headers to the request'
do
user
=
create
(
:user
,
username:
'username'
)
user
=
create
(
:user
,
username:
'username'
)
project
=
create
(
:project
,
name:
'project'
)
project
=
create
(
:project
,
name:
'project'
)
push_sample_data
=
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
push_sample_data
=
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
jenkins_service
=
described_class
.
create
(
jenkins_service
=
described_class
.
create
(
jenkins_params
)
active:
true
,
project:
project
,
properties:
{
jenkins_url:
'http://jenkins.example.com/'
,
project_name:
'my_project'
}
)
stub_request
(
:post
,
jenkins_service
.
hook_url
)
stub_request
(
:post
,
jenkins_service
.
hook_url
)
jenkins_service
.
execute
(
push_sample_data
)
jenkins_service
.
execute
(
push_sample_data
)
...
...
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