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
9c990bbe
Commit
9c990bbe
authored
Apr 03, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test
parent
d6b18d39
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
lib/gitlab/ci/trace/stream.rb
lib/gitlab/ci/trace/stream.rb
+6
-2
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+16
-0
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
9c990bbe
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
attr_reader
:stream
attr_reader
:stream
delegate
:close
,
:tell
,
:seek
,
:size
,
:
path
,
:
url
,
:truncate
,
to: :stream
,
allow_nil:
true
delegate
:close
,
:tell
,
:seek
,
:size
,
:url
,
:truncate
,
to: :stream
,
allow_nil:
true
delegate
:valid?
,
to: :stream
,
as: :present?
,
allow_nil:
true
delegate
:valid?
,
to: :stream
,
as: :present?
,
allow_nil:
true
...
@@ -22,7 +22,11 @@ module Gitlab
...
@@ -22,7 +22,11 @@ module Gitlab
end
end
def
file?
def
file?
self
.
path
.
present?
if
respond_to?
(
:path
)
self
.
path
.
present?
end
def
path
self
.
stream
.
path
if
self
.
stream
.
respond_to?
(
:path
)
end
end
def
limit
(
last_bytes
=
LIMIT_SIZE
)
def
limit
(
last_bytes
=
LIMIT_SIZE
)
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
9c990bbe
...
@@ -513,6 +513,22 @@ describe Projects::JobsController do
...
@@ -513,6 +513,22 @@ describe Projects::JobsController do
end
end
end
end
context
'when job has a trace in database'
do
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
before
do
job
.
update_column
(
:trace
,
'Sample trace'
)
end
it
'send a trace file'
do
response
=
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
content_type
).
to
eq
'text/plain; charset=utf-8'
expect
(
response
.
body
).
to
eq
'Sample trace'
end
end
context
'when job does not have a trace file'
do
context
'when job does not have a trace file'
do
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:job
)
{
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