Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-25 13:59:28 +0300
committerShinya Maeda <shinya@gitlab.com>2018-06-25 13:59:28 +0300
commit58a1a0b70c7df0947864d0be933faf0153b537ec (patch)
tree12981201dfc7b9258bdd0bb4bbcdaa035e4475ff /spec/models/ci
parent44cc58765242afc2e035c2972447be2afae8d153 (diff)
Support append/truncate for fog store
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_trace_chunk_spec.rb39
1 files changed, 30 insertions, 9 deletions
diff --git a/spec/models/ci/build_trace_chunk_spec.rb b/spec/models/ci/build_trace_chunk_spec.rb
index 2b4dfba5c2a..94a5fe8e5f8 100644
--- a/spec/models/ci/build_trace_chunk_spec.rb
+++ b/spec/models/ci/build_trace_chunk_spec.rb
@@ -256,11 +256,31 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context 'when data_store is fog' do
let(:data_store) { :fog }
- let(:data) { '' }
- let(:offset) { 0 }
- it 'can not append' do
- expect { subject }.to raise_error('Fog store does not support appending')
+ context 'when there are no data' do
+ let(:data) { '' }
+
+ it 'has no data' do
+ expect(build_trace_chunk.data).to be_empty
+ end
+
+ it_behaves_like 'Appending correctly'
+ it_behaves_like 'Scheduling no sidekiq worker'
+ end
+
+ context 'when there are some data' do
+ let(:data) { 'Sample data in fog' }
+
+ before do
+ build_trace_chunk.send(:unsafe_set_data!, data)
+ end
+
+ it 'has data' do
+ expect(build_trace_chunk.data).to eq(data)
+ end
+
+ it_behaves_like 'Appending correctly'
+ it_behaves_like 'Scheduling no sidekiq worker'
end
end
end
@@ -313,12 +333,13 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context 'when data_store is fog' do
let(:data_store) { :fog }
- let(:data) { '' }
- let(:offset) { 0 }
+ let(:data) { 'Sample data in fog' }
- it 'can not truncate' do
- expect { subject }.to raise_error('Fog store does not support truncating')
+ before do
+ build_trace_chunk.send(:unsafe_set_data!, data)
end
+
+ it_behaves_like 'truncates'
end
end
@@ -373,7 +394,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
context 'when data does not exist' do
- it { expect { subject }.to raise_error(Excon::Error::NotFound) }
+ it { is_expected.to eq(0) }
end
end
end