summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-10-19 05:03:53 -0700
committerStan Hu <stanhu@gmail.com>2018-10-19 05:03:53 -0700
commit9065599e7947e44ea51be9824fe60b0d858b1605 (patch)
treee2f9f0b4b2c5c2087117809b07df8903f5afcd4f /spec/lib
parent4c4d1b792867195920fb6d6fb41cfa03a99cd299 (diff)
downloadgitlab-ce-9065599e7947e44ea51be9824fe60b0d858b1605.tar.gz
Add a spec that generates the metadata dynamicallysh-pages-eof-error
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb30
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