Fix rubocop

This commit is contained in:
Shinya Maeda 2018-04-06 00:57:05 +09:00
parent 8c86705206
commit 1a71dd049b
4 changed files with 17 additions and 11 deletions

View File

@ -13,14 +13,13 @@ module Ci
enum data_store: {
redis: 1,
db: 2,
db: 2
}
def data
case
when redis?
if redis?
redis_data
when db?
elsif db?
raw_data
else
raise 'Unsupported data store'
@ -30,10 +29,9 @@ module Ci
def set_data(value)
raise 'too much data' if value.bytesize > CHUNK_SIZE
case
when redis?
if redis?
redis_set_data(value)
when db?
elsif db?
self.raw_data = value
else
raise 'Unsupported data store'

View File

@ -69,7 +69,7 @@ module Gitlab
def read(length = nil, outbuf = "")
out = ""
length = size - tell unless length
length ||= size - tell
until length <= 0 || eof?
data = chunk_slice_from_offset

View File

@ -228,6 +228,8 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do
File.open(path)
end
end
it_behaves_like 'sets'
end
context 'when stream is ChunkedIO' do

View File

@ -540,7 +540,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do
stub_feature_flags(ci_enable_live_trace: false)
build; src_path; src_checksum; # Initialize after set feature flag
build # Initialize after set feature flag
src_path
src_checksum
end
it_behaves_like 'archive trace file'
@ -571,7 +573,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do
stub_feature_flags(ci_enable_live_trace: false)
build; trace_content; src_checksum; # Initialize after set feature flag
build # Initialize after set feature flag
trace_content
src_checksum
build.update_column(:trace, trace_content)
end
@ -625,7 +629,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do
stub_feature_flags(ci_enable_live_trace: true)
build; trace_raw; src_checksum; # Initialize after set feature flag
build # Initialize after set feature flag
trace_raw
src_checksum
end
it_behaves_like 'archive trace file in ChunkedIO'