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 BigCollectionsControllerTest < ActionController::TestCase
13 include ManifestExamples
16 Blob.stubs(:sign_locator).returns 'd41d8cd98f00b204e9800998ecf8427e+0'
19 test "combine two big and two small collections" do
20 @controller = ActionsController.new
21 bigmanifest1 = time_block 'build example' do
22 make_manifest(streams: 100,
23 files_per_stream: 100,
27 bigmanifest2 = bigmanifest1.gsub '.txt', '.txt2'
28 smallmanifest1 = ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:small1.txt\n"
29 smallmanifest2 = ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:small2.txt\n"
30 totalsize = bigmanifest1.length + bigmanifest2.length +
31 smallmanifest1.length + smallmanifest2.length
32 parts = time_block "create (total #{totalsize>>20}MiB)" do
35 big1: Collection.create(manifest_text: bigmanifest1),
36 big2: Collection.create(manifest_text: bigmanifest2),
37 small1: Collection.create(manifest_text: smallmanifest1),
38 small2: Collection.create(manifest_text: smallmanifest2),
42 time_block 'combine' do
43 post :combine_selected_files_into_collection, {
44 selection: [parts[:big1].uuid,
46 parts[:small1].uuid + '/small1.txt',
47 parts[:small2].uuid + '/small2.txt',
50 }, session_for(:active)
52 assert_response :redirect
55 [:json, :html].each do |format|
56 test "show collection with big manifest (#{format})" do
57 bigmanifest = time_block 'build example' do
58 make_manifest(streams: 100,
59 files_per_stream: 100,
63 @controller = CollectionsController.new
64 c = time_block "create (manifest size #{bigmanifest.length>>20}MiB)" do
66 Collection.create(manifest_text: bigmanifest)
70 get :show, {id: c.uuid, format: format}, session_for(:active)
72 assert_response :success