1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
6 require 'helpers/manifest_examples'
7 require 'helpers/time_block'
12 class BigCollectionTest < ActiveSupport::TestCase
13 include ManifestExamples
16 Blob.stubs(:sign_locator).returns 'd41d8cd98f00b204e9800998ecf8427e+0'
20 Thread.current[:arvados_api_client] = nil
23 # You can try with compress=false here too, but at last check it
24 # didn't make a significant difference.
25 [true].each do |compress|
26 test "crud cycle for collection with big manifest (compress=#{compress})" do
27 Rails.configuration.api_response_compression = compress
28 Thread.current[:arvados_api_client] = nil
35 bigmanifest = time_block 'build example' do
36 make_manifest(streams: 100,
37 files_per_stream: 100,
41 c = time_block "new (manifest size = #{bigmanifest.length>>20}MiB)" do
42 Collection.new manifest_text: bigmanifest
44 time_block 'create' do
48 Collection.find c.uuid
50 time_block 'read(cached)' do
51 Collection.find c.uuid
54 list = Collection.select(['uuid', 'manifest_text']).filter [['uuid','=',c.uuid]]
55 assert_equal 1, list.count
56 assert_equal c.uuid, list.first.uuid
57 assert_not_nil list.first.manifest_text
59 time_block 'update(name-only)' do
60 manifest_text_length = c.manifest_text.length
61 c.update_attributes name: 'renamed during test case'
62 assert_equal c.manifest_text.length, manifest_text_length
64 time_block 'update' do
65 c.manifest_text += ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:empty.txt\n"
68 time_block 'delete' do
71 time_block 'read(404)' do
72 assert_empty Collection.filter([['uuid','=',c.uuid]])