diff options
Diffstat (limited to 'spec/lib/gitlab/ci/trace_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/trace_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/trace_spec.rb b/spec/lib/gitlab/ci/trace_spec.rb index 85edf27d3e7..171877dbaee 100644 --- a/spec/lib/gitlab/ci/trace_spec.rb +++ b/spec/lib/gitlab/ci/trace_spec.rb @@ -11,6 +11,29 @@ RSpec.describe Gitlab::Ci::Trace, :clean_gitlab_redis_shared_state do it { expect(trace).to delegate_method(:old_trace).to(:job) } end + context 'when trace is migrated to object storage' do + let!(:job) { create(:ci_build, :trace_artifact) } + let!(:artifact1) { job.job_artifacts_trace } + let!(:artifact2) { job.reload.job_artifacts_trace } + let(:test_data) { "hello world" } + + before do + stub_artifacts_object_storage + + artifact1.file.migrate!(ObjectStorage::Store::REMOTE) + end + + it 'reloads the trace after is it migrated' do + stub_const('Gitlab::HttpIO::BUFFER_SIZE', test_data.length) + + expect_next_instance_of(Gitlab::HttpIO) do |http_io| + expect(http_io).to receive(:get_chunk).and_return(test_data, "") + end + + expect(artifact2.job.trace.raw).to eq(test_data) + end + end + context 'when live trace feature is disabled' do before do stub_feature_flags(ci_enable_live_trace: false) |