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-03-01 11:38:44 +0300
committerShinya Maeda <shinya@gitlab.com>2018-03-06 15:43:20 +0300
commit3a5cb44f65ac2329e1119ddf01f15bf72ac86765 (patch)
tree41753f6443f2281374aadca29b7cad18401712ce
parent583b49f08e5799508d5ebdf7e6f6ccbbe0a0d0bf (diff)
Fix static analysys
-rw-r--r--lib/gitlab/ci/trace.rb1
-rw-r--r--spec/lib/gitlab/ci/trace_spec.rb14
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index 98481f3580a..256cd2c5e4a 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -125,6 +125,7 @@ module Gitlab
FileUtils.touch(temp_path)
size = IO.copy_stream(src_stream, temp_path)
raise 'Not all saved' unless size == src_stream.size
+
yield(temp_path)
end
end
diff --git a/spec/lib/gitlab/ci/trace_spec.rb b/spec/lib/gitlab/ci/trace_spec.rb
index ba7153ed04d..e25a904416c 100644
--- a/spec/lib/gitlab/ci/trace_spec.rb
+++ b/spec/lib/gitlab/ci/trace_spec.rb
@@ -439,7 +439,7 @@ describe Gitlab::Ci::Trace do
expect(build.old_trace).to be_nil
expect(src_checksum)
.to eq(Digest::SHA256.file(build.job_artifacts_trace.file.path).digest)
- end
+ end
end
shared_examples 'source trace in database stays intact' do |error:|
@@ -463,7 +463,7 @@ describe Gitlab::Ci::Trace do
context 'when failed to create clone file' do
before do
- allow_any_instance_of(Gitlab::Ci::Trace)
+ allow_any_instance_of(described_class)
.to receive(:clone_file!).and_raise('Not all saved')
end
@@ -474,7 +474,7 @@ describe Gitlab::Ci::Trace do
before do
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", 'Error'])
+ .and_return(%w[Error Error])
end
it_behaves_like 'source trace file stays intact', error: ActiveRecord::RecordInvalid
@@ -494,7 +494,7 @@ describe Gitlab::Ci::Trace do
context 'when failed to create clone file' do
before do
- allow_any_instance_of(Gitlab::Ci::Trace)
+ allow_any_instance_of(described_class)
.to receive(:clone_file!).and_raise('Not all saved')
end
@@ -505,7 +505,7 @@ describe Gitlab::Ci::Trace do
before do
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", 'Error'])
+ .and_return(%w[Error Error])
end
it_behaves_like 'source trace in database stays intact', error: ActiveRecord::RecordInvalid
@@ -519,7 +519,7 @@ describe Gitlab::Ci::Trace do
end
it 'does not archive' do
- expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive_stream!)
+ expect_any_instance_of(described_class).not_to receive(:archive_stream!)
expect { subject }.to raise_error('Already archived')
expect(build.job_artifacts_trace.file.exists?).to be_truthy
end
@@ -529,7 +529,7 @@ describe Gitlab::Ci::Trace do
let!(:build) { create(:ci_build, :running, :trace_live) }
it 'does not archive' do
- expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive_stream!)
+ expect_any_instance_of(described_class).not_to receive(:archive_stream!)
expect { subject }.to raise_error('Job is not finished yet')
expect(build.trace.exist?).to be_truthy
end