diff options
| author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-23 06:40:57 +0000 |
|---|---|---|
| committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-23 06:40:57 +0000 |
| commit | 075bbd4cb614783b7b49613c70088fe6bca766d2 (patch) | |
| tree | 067ac1fe61d81ca3aa4a931c098a2e057471e131 /spec/lib | |
| parent | 6691d5f9b6fb60bacd7252d001e7a5fe59c90e3f (diff) | |
| parent | 9065599e7947e44ea51be9824fe60b0d858b1605 (diff) | |
| download | gitlab-ce-075bbd4cb614783b7b49613c70088fe6bca766d2.tar.gz | |
Merge branch 'sh-pages-eof-error' into 'master'
Fix EOF detection with CI artifacts metadata
Closes #36954
See merge request gitlab-org/gitlab-ce!22479
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb index e327399d82d..a9a4af1f455 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb @@ -112,4 +112,34 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do end end end + + context 'generated metadata' do + let(:tmpfile) { Tempfile.new('test-metadata') } + let(:generator) { CiArtifactMetadataGenerator.new(tmpfile) } + let(:entry_count) { 5 } + + before do + tmpfile.binmode + + (1..entry_count).each do |index| + generator.add_entry("public/test-#{index}.txt") + end + + generator.write + end + + after do + File.unlink(tmpfile.path) + end + + describe '#find_entries!' do + it 'reads expected number of entries' do + stream = File.open(tmpfile.path) + + metadata = described_class.new(stream, 'public', { recursive: true }) + + expect(metadata.find_entries!.count).to eq entry_count + end + end + end end |
