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
Léo-Paul Géneau
gitlab-ce
Commits
6ed91266
Commit
6ed91266
authored
May 02, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip truncate when offset == size. Fix static analysys.
parent
65c11f32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
lib/gitlab/ci/trace/chunked_io.rb
lib/gitlab/ci/trace/chunked_io.rb
+1
-0
spec/models/ci/build_trace_chunk_spec.rb
spec/models/ci/build_trace_chunk_spec.rb
+6
-4
No files found.
lib/gitlab/ci/trace/chunked_io.rb
View file @
6ed91266
...
@@ -135,6 +135,7 @@ module Gitlab
...
@@ -135,6 +135,7 @@ module Gitlab
def
truncate
(
offset
)
def
truncate
(
offset
)
raise
ArgumentError
,
'Outside of file'
if
offset
>
size
raise
ArgumentError
,
'Outside of file'
if
offset
>
size
return
if
offset
==
size
# Skip the following process as it doesn't affect anything
@tell
=
offset
@tell
=
offset
@size
=
offset
@size
=
offset
...
...
spec/models/ci/build_trace_chunk_spec.rb
View file @
6ed91266
...
@@ -345,7 +345,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -345,7 +345,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
shared_examples_for
'deletes all build_trace_chunk and data in redis'
do
shared_examples_for
'deletes all build_trace_chunk and data in redis'
do
it
do
it
do
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
3
)
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
size
).
to
eq
(
3
)
end
end
expect
(
described_class
.
count
).
to
eq
(
3
)
expect
(
described_class
.
count
).
to
eq
(
3
)
...
@@ -355,14 +355,16 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -355,14 +355,16 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
expect
(
described_class
.
count
).
to
eq
(
0
)
expect
(
described_class
.
count
).
to
eq
(
0
)
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
0
)
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
size
).
to
eq
(
0
)
end
end
end
end
end
end
context
'when
build is destroy
ed'
do
context
'when
traces are archiv
ed'
do
let
(
:subject
)
do
let
(
:subject
)
do
project
.
builds
.
destroy_all
project
.
builds
.
each
do
|
build
|
build
.
success!
end
end
end
it_behaves_like
'deletes all build_trace_chunk and data in redis'
it_behaves_like
'deletes all build_trace_chunk and data in redis'
...
...
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