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:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-03-08 18:55:47 +0300
committerMicaël Bergeron <mbergeron@gitlab.com>2018-03-08 18:55:47 +0300
commit6466739e2e61f790a9e1f09020dba710c4078a0f (patch)
tree35d990feb7a96c149297ccbbd3a6c28525d8ae82 /spec/services/ci
parentedbcde8877f497ea675fde811065679286a1aa56 (diff)
parentac1f3bc3e43ad90de16b6ad12f549c9838f51e3b (diff)
Merge remote-tracking branch 'origin/master' into 40781-os-to-ce
Diffstat (limited to 'spec/services/ci')
-rw-r--r--spec/services/ci/create_trace_artifact_service_spec.rb63
1 files changed, 0 insertions, 63 deletions
diff --git a/spec/services/ci/create_trace_artifact_service_spec.rb b/spec/services/ci/create_trace_artifact_service_spec.rb
deleted file mode 100644
index 8c5e8e438c7..00000000000
--- a/spec/services/ci/create_trace_artifact_service_spec.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-require 'spec_helper'
-
-describe Ci::CreateTraceArtifactService do
- describe '#execute' do
- subject { described_class.new(nil, nil).execute(job) }
-
- context 'when the job does not have trace artifact' do
- context 'when the job has a trace file' do
- let!(:job) { create(:ci_build, :trace_live) }
- let!(:legacy_path) { job.trace.read { |stream| return stream.path } }
- let!(:legacy_checksum) { Digest::SHA256.file(legacy_path).hexdigest }
- let(:new_path) { job.job_artifacts_trace.file.path }
- let(:new_checksum) { Digest::SHA256.file(new_path).hexdigest }
-
- it { expect(File.exist?(legacy_path)).to be_truthy }
-
- it 'creates trace artifact' do
- expect { subject }.to change { Ci::JobArtifact.count }.by(1)
-
- expect(File.exist?(legacy_path)).to be_falsy
- expect(File.exist?(new_path)).to be_truthy
- expect(new_checksum).to eq(legacy_checksum)
- expect(job.job_artifacts_trace.file.exists?).to be_truthy
- expect(job.job_artifacts_trace.file.filename).to eq('job.log')
- end
-
- context 'when failed to create trace artifact record' do
- before do
- # When ActiveRecord error happens
- allow_any_instance_of(Ci::JobArtifact).to receive(:save).and_return(false)
- allow_any_instance_of(Ci::JobArtifact).to receive_message_chain(:errors, :full_messages)
- .and_return("Error")
-
- subject rescue nil
-
- job.reload
- end
-
- it 'keeps legacy trace and removes trace artifact' do
- expect(File.exist?(legacy_path)).to be_truthy
- expect(job.job_artifacts_trace).to be_nil
- end
- end
- end
-
- context 'when the job does not have a trace file' do
- let!(:job) { create(:ci_build) }
-
- it 'does not create trace artifact' do
- expect { subject }.not_to change { Ci::JobArtifact.count }
- end
- end
- end
-
- context 'when the job has already had trace artifact' do
- let!(:job) { create(:ci_build, :trace_artifact) }
-
- it 'does not create trace artifact' do
- expect { subject }.not_to change { Ci::JobArtifact.count }
- end
- end
- end
-end