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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /spec/lib/gitlab/ci/trace
parent4b1de649d0168371549608993deac953eb692019 (diff)
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/trace')
-rw-r--r--spec/lib/gitlab/ci/trace/checksum_spec.rb44
1 files changed, 40 insertions, 4 deletions
diff --git a/spec/lib/gitlab/ci/trace/checksum_spec.rb b/spec/lib/gitlab/ci/trace/checksum_spec.rb
index 794794c3f69..a343d74f755 100644
--- a/spec/lib/gitlab/ci/trace/checksum_spec.rb
+++ b/spec/lib/gitlab/ci/trace/checksum_spec.rb
@@ -8,8 +8,12 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
subject { described_class.new(build) }
context 'when build pending state exists' do
+ let(:trace_details) do
+ { trace_checksum: 'crc32:d4777540', trace_bytesize: 262161 }
+ end
+
before do
- create(:ci_build_pending_state, build: build, trace_checksum: 'crc32:d4777540')
+ create(:ci_build_pending_state, build: build, **trace_details)
end
context 'when matching persisted trace chunks exist' do
@@ -22,6 +26,7 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
it 'calculates combined trace chunks CRC32 correctly' do
expect(subject.chunks_crc32).to eq 3564598592
expect(subject).to be_valid
+ expect(subject).not_to be_corrupted
end
end
@@ -32,8 +37,9 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
create_chunk(index: 2, data: 'ccccccccccccccccc')
end
- it 'makes trace checksum invalid' do
+ it 'makes trace checksum invalid but not corrupted' do
expect(subject).not_to be_valid
+ expect(subject).not_to be_corrupted
end
end
@@ -43,8 +49,9 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
create_chunk(index: 2, data: 'ccccccccccccccccc')
end
- it 'makes trace checksum invalid' do
+ it 'makes trace checksum invalid and corrupted' do
expect(subject).not_to be_valid
+ expect(subject).to be_corrupted
end
end
@@ -55,8 +62,9 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
create_chunk(index: 2, data: 'ccccccccccccccccc')
end
- it 'makes trace checksum invalid' do
+ it 'makes trace checksum invalid but not corrupted' do
expect(subject).not_to be_valid
+ expect(subject).not_to be_corrupted
end
end
@@ -99,6 +107,14 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
it 'returns nil' do
expect(subject.last_chunk).to be_nil
end
+
+ it 'is not a valid trace' do
+ expect(subject).not_to be_valid
+ end
+
+ it 'is not a corrupted trace' do
+ expect(subject).not_to be_corrupted
+ end
end
context 'when there are multiple chunks' do
@@ -110,6 +126,26 @@ RSpec.describe Gitlab::Ci::Trace::Checksum do
it 'returns chunk with the highest index' do
expect(subject.last_chunk.chunk_index).to eq 1
end
+
+ it 'is not a valid trace' do
+ expect(subject).not_to be_valid
+ end
+
+ it 'is not a corrupted trace' do
+ expect(subject).not_to be_corrupted
+ end
+ end
+ end
+
+ describe '#trace_size' do
+ before do
+ create_chunk(index: 0, data: 'a' * 128.kilobytes)
+ create_chunk(index: 1, data: 'b' * 128.kilobytes)
+ create_chunk(index: 2, data: 'abcdefg-ΓΌ')
+ end
+
+ it 'returns total trace size in bytes' do
+ expect(subject.trace_size).to eq 262154
end
end