Merge branch '17175-boot-fail-rake-seed'
[arvados.git] / sdk / ruby / test / test_big_request.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 require 'minitest/autorun'
6 require 'arvados'
7 require 'digest/md5'
8
9 class TestBigRequest < Minitest::Test
10   def boring_manifest nblocks
11     x = '.'
12     (0..nblocks).each do |z|
13       x += ' d41d8cd98f00b204e9800998ecf8427e+0'
14     end
15     x += " 0:0:foo.txt\n"
16     x
17   end
18
19   def test_create_manifest nblocks=1
20     skip "Test needs an API server to run against"
21     manifest_text = boring_manifest nblocks
22     uuid = Digest::MD5.hexdigest(manifest_text) + '+' + manifest_text.size.to_s
23     c = Arvados.new.collection.create(collection: {
24                                         uuid: uuid,
25                                         manifest_text: manifest_text,
26                                       })
27     assert_equal uuid, c[:portable_data_hash]
28   end
29
30   def test_create_big_manifest
31     # This ensures that manifest_text is passed in the request body:
32     # it's too large to fit in the query string.
33     test_create_manifest 9999
34   end
35 end