diff options
Diffstat (limited to 'spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb b/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb deleted file mode 100644 index 7991ad69007..00000000000 --- a/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::BackgroundMigration::ArchiveLegacyTraces do - include TraceHelpers - - let(:namespaces) { table(:namespaces) } - let(:projects) { table(:projects) } - let(:builds) { table(:ci_builds) } - let(:job_artifacts) { table(:ci_job_artifacts) } - - before do - namespaces.create!(id: 123, name: 'gitlab1', path: 'gitlab1') - projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1', namespace_id: 123) - @build = builds.create!(id: 1, project_id: 123, status: 'success', type: 'Ci::Build') - end - - context 'when trace file exsits at the right place' do - before do - create_legacy_trace(@build, 'trace in file') - end - - it 'correctly archive legacy traces' do - expect(job_artifacts.count).to eq(0) - expect(File.exist?(legacy_trace_path(@build))).to be_truthy - - described_class.new.perform(1, 1) - - expect(job_artifacts.count).to eq(1) - expect(File.exist?(legacy_trace_path(@build))).to be_falsy - expect(File.read(archived_trace_path(job_artifacts.first))).to eq('trace in file') - end - end - - context 'when trace file does not exsits at the right place' do - it 'does not raise errors nor create job artifact' do - expect { described_class.new.perform(1, 1) }.not_to raise_error - - expect(job_artifacts.count).to eq(0) - end - end - - context 'when trace data exsits in database' do - before do - create_legacy_trace_in_db(@build, 'trace in db') - end - - it 'correctly archive legacy traces' do - expect(job_artifacts.count).to eq(0) - expect(@build.read_attribute(:trace)).not_to be_empty - - described_class.new.perform(1, 1) - - @build.reload - expect(job_artifacts.count).to eq(1) - expect(@build.read_attribute(:trace)).to be_nil - expect(File.read(archived_trace_path(job_artifacts.first))).to eq('trace in db') - end - end -end |