1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 require 'helpers/manifest_examples'
8 require 'helpers/time_block'
10 class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
11 include ManifestExamples
13 slow_test "crud cycle for a collection with a big manifest" do
14 bigmanifest = time_block 'make example' do
15 make_manifest(streams: 100,
16 files_per_stream: 100,
18 bytes_per_block: 2**26,
19 api_token: api_token(:active))
21 json = time_block "JSON encode #{bigmanifest.length>>20}MiB manifest" do
22 SafeJSON.dump({"manifest_text" => bigmanifest})
24 time_block 'create' do
25 post '/arvados/v1/collections',
26 params: {collection: json},
27 headers: auth(:active)
28 assert_response :success
30 uuid = json_response['uuid']
32 get '/arvados/v1/collections/' + uuid, params: {}, headers: auth(:active)
33 assert_response :success
36 get '/arvados/v1/collections',
37 params: {select: ['manifest_text'], filters: [['uuid', '=', uuid]].to_json},
38 headers: auth(:active)
39 assert_response :success
41 time_block 'update' do
42 put '/arvados/v1/collections/' + uuid,
43 params: {collection: json},
44 headers: auth(:active)
45 assert_response :success
47 time_block 'delete' do
48 delete '/arvados/v1/collections/' + uuid, params: {}, headers: auth(:active)
52 slow_test "memory usage" do
53 hugemanifest = make_manifest(streams: 1,
54 files_per_stream: 2000,
56 bytes_per_block: 2**26,
57 api_token: api_token(:active))
58 json = time_block "JSON encode #{hugemanifest.length>>20}MiB manifest" do
59 SafeJSON.dump({manifest_text: hugemanifest})
62 post '/arvados/v1/collections',
63 params: {collection: json},
64 headers: auth(:active)