1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 require 'minitest/autorun'
7 require 'active_support'
8 require 'active_support/core_ext'
11 class TestCollectionCreate < Minitest::Test
15 def test_small_collection
16 uuid = Digest::MD5.hexdigest(foo_manifest) + '+' + foo_manifest.size.to_s
17 out, err = capture_subprocess_io do
18 assert_arv('--format', 'uuid', 'collection', 'create', '--collection', {
20 manifest_text: foo_manifest
23 assert /^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out)
27 def test_read_resource_object_from_file
28 tempfile = Tempfile.new('collection')
30 tempfile.write({manifest_text: foo_manifest}.to_json)
32 out, err = capture_subprocess_io do
33 assert_arv('--format', 'uuid',
34 'collection', 'create', '--collection', tempfile.path)
36 assert /^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out)
45 expect = case args.first
52 system(['./bin/arv', 'arv'], *args),
53 "`arv #{args.join ' '}` " +
54 "should exit #{if expect then 0 else 'non-zero' end}")
58 ". #{Digest::MD5.hexdigest('foo')}+3 0:3:foo\n"