9687: For a ContainerRequest being committed, if its container has the state "Complet...
[arvados.git] / services / api / test / helpers / manifest_examples.rb
1 module ManifestExamples
2   def make_manifest opts={}
3     opts = {
4       bytes_per_block: 1,
5       blocks_per_file: 1,
6       files_per_stream: 1,
7       streams: 1,
8     }.merge(opts)
9     datablip = "x" * opts[:bytes_per_block]
10     locator = Blob.sign_locator(Digest::MD5.hexdigest(datablip) +
11                                 '+' + datablip.length.to_s,
12                                 api_token: opts[:api_token])
13     filesize = datablip.length * opts[:blocks_per_file]
14     txt = ''
15     (1..opts[:streams]).each do |s|
16       streamtoken = "./stream#{s}"
17       streamsize = 0
18       blocktokens = []
19       filetokens = []
20       (1..opts[:files_per_stream]).each do |f|
21         filetokens << "#{streamsize}:#{filesize}:file#{f}.txt"
22         (1..opts[:blocks_per_file]).each do |b|
23           blocktokens << locator
24         end
25         streamsize += filesize
26       end
27       txt << ([streamtoken] + blocktokens + filetokens).join(' ') + "\n"
28     end
29     txt
30   end
31 end