Commit 1a71dd04 authored by Shinya Maeda's avatar Shinya Maeda

Fix rubocop

parent 8c867052
...@@ -13,14 +13,13 @@ module Ci ...@@ -13,14 +13,13 @@ module Ci
enum data_store: { enum data_store: {
redis: 1, redis: 1,
db: 2, db: 2
} }
def data def data
case if redis?
when redis?
redis_data redis_data
when db? elsif db?
raw_data raw_data
else else
raise 'Unsupported data store' raise 'Unsupported data store'
...@@ -30,10 +29,9 @@ module Ci ...@@ -30,10 +29,9 @@ module Ci
def set_data(value) def set_data(value)
raise 'too much data' if value.bytesize > CHUNK_SIZE raise 'too much data' if value.bytesize > CHUNK_SIZE
case if redis?
when redis?
redis_set_data(value) redis_set_data(value)
when db? elsif db?
self.raw_data = value self.raw_data = value
else else
raise 'Unsupported data store' raise 'Unsupported data store'
......
...@@ -69,7 +69,7 @@ module Gitlab ...@@ -69,7 +69,7 @@ module Gitlab
def read(length = nil, outbuf = "") def read(length = nil, outbuf = "")
out = "" out = ""
length = size - tell unless length length ||= size - tell
until length <= 0 || eof? until length <= 0 || eof?
data = chunk_slice_from_offset data = chunk_slice_from_offset
......
...@@ -228,6 +228,8 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do ...@@ -228,6 +228,8 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do
File.open(path) File.open(path)
end end
end end
it_behaves_like 'sets'
end end
context 'when stream is ChunkedIO' do context 'when stream is ChunkedIO' do
......
...@@ -540,7 +540,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do ...@@ -540,7 +540,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do before do
stub_feature_flags(ci_enable_live_trace: false) 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 end
it_behaves_like 'archive trace file' it_behaves_like 'archive trace file'
...@@ -571,7 +573,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do ...@@ -571,7 +573,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do before do
stub_feature_flags(ci_enable_live_trace: false) 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) build.update_column(:trace, trace_content)
end end
...@@ -625,7 +629,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do ...@@ -625,7 +629,9 @@ describe Gitlab::Ci::Trace, :clean_gitlab_redis_cache do
before do before do
stub_feature_flags(ci_enable_live_trace: true) 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 end
it_behaves_like 'archive trace file in ChunkedIO' it_behaves_like 'archive trace file in ChunkedIO'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment