[ARVADOS] updated: b5c6c4747c589d3627ce1bb0edb8dacd8313c7e9
git at public.curoverse.com
git at public.curoverse.com
Thu Mar 5 09:49:20 EST 2015
Summary of changes:
.../test/controllers/actions_controller_test.rb | 121 +++++++++++++++++++++
services/api/test/fixtures/collections.yml | 37 +++++++
2 files changed, 158 insertions(+)
via b5c6c4747c589d3627ce1bb0edb8dacd8313c7e9 (commit)
from d67d6c4e86ecc98d433c7f6da270cd9d43072dc0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit b5c6c4747c589d3627ce1bb0edb8dacd8313c7e9
Author: Radhika Chippada <radhika at curoverse.com>
Date: Thu Mar 5 09:27:44 2015 -0500
5145: add tests to verify combine collections with duplicate filenames
diff --git a/apps/workbench/test/controllers/actions_controller_test.rb b/apps/workbench/test/controllers/actions_controller_test.rb
index 0e28b06..4f33038 100644
--- a/apps/workbench/test/controllers/actions_controller_test.rb
+++ b/apps/workbench/test/controllers/actions_controller_test.rb
@@ -42,4 +42,125 @@ class ActionsControllerTest < ActionController::TestCase
assert manifest_text.include?('dir2'), 'Not found dir2 in new collection manifest text'
end
+ test "combine files with repeated names into new collection" do
+ post(:combine_selected_files_into_collection, {
+ selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
+ 'zzzzz-4zz18-00000nonamecoll/foo',
+ 'zzzzz-4zz18-abcd6fx123409f7/foo',
+ 'zzzzz-4zz18-ehbhgtheo8909or/bar',
+ 'zzzzz-4zz18-y9vne9npefyxh8g/baz',
+ '1fd08fc162a5c6413070a8bd0bffc818+150'],
+ format: "json"},
+ session_for(:active))
+
+ assert_response 302 # collection created and redirected to new collection page
+
+ assert response.headers['Location'].include? '/collections/'
+ new_collection_uuid = response.headers['Location'].split('/')[-1]
+
+ use_token :active
+ collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first
+ manifest_text = collection['manifest_text']
+ assert manifest_text.include?('foo'), 'Not found foo in new collection manifest text'
+ assert manifest_text.include?('foo(1)'), 'Not found foo(1) in new collection manifest text'
+ assert manifest_text.include?('foo(2)'), 'Not found foo(2) in new collection manifest text'
+ assert manifest_text.include?('bar'), 'Not found bar in new collection manifest text'
+ assert manifest_text.include?('baz'), 'Not found baz in new collection manifest text'
+ assert manifest_text.include?('0:0:file1 0:0:file2 0:0:file3'),
+ 'Not found 0:0:file1 0:0:file2 0:0:file3 in new collection manifest text'
+ assert manifest_text.include?('dir1/subdir'), 'Not found dir1/subdir in new collection manifest text'
+ assert manifest_text.include?('dir2'), 'Not found dir2 in new collection manifest text'
+ end
+
+ test "combine collections with repeated filenames in almost similar directories and expect files with proper suffixes" do
+ post(:combine_selected_files_into_collection, {
+ selection: ['zzzzz-4zz18-duplicatenames1',
+ 'zzzzz-4zz18-duplicatenames2',
+ 'zzzzz-4zz18-znfnqtbbv4spc3w/foo',
+ 'zzzzz-4zz18-00000nonamecoll/foo',],
+ format: "json"},
+ session_for(:active))
+
+ assert_response 302 # collection created and redirected to new collection page
+
+ assert response.headers['Location'].include? '/collections/'
+ new_collection_uuid = response.headers['Location'].split('/')[-1]
+
+ use_token :active
+ collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first
+ manifest_text = collection['manifest_text']
+
+ assert manifest_text.include?('foo'), 'Not found foo in new collection manifest text'
+ assert manifest_text.include?('foo(1)'), 'Not found foo(1) in new collection manifest text'
+
+ streams = manifest_text.split "\n"
+ streams.each do |stream|
+ if stream.start_with? './dir1'
+ # dir1 stream
+ assert stream.include?(':alice(1)'), 'Not found: alice(1) in dir1'
+ assert stream.include?(':alice.txt'), 'Not found: alice.txt in dir1'
+ assert stream.include?(':alice(1).txt'), 'Not found: alice(1).txt in dir1'
+ assert stream.include?(':bob.txt'), 'Not found: bob.txt in dir1'
+ assert stream.include?(':carol.txt'), 'Not found: carol.txt in dir1'
+ elsif stream.start_with? './dir2'
+ # dir2 stream
+ assert stream.include?(':alice.txt'), 'Not found: alice.txt in dir2'
+ assert stream.include?(':alice(1).txt'), 'Not found: alice(1).txt in dir2'
+ elsif stream.start_with? '. '
+ # . stream
+ assert stream.include?(':foo'), 'Not found: foo in .'
+ assert stream.include?(':foo(1)'), 'Not found: foo(1) in .'
+ end
+ end
+ end
+
+ test "combine collections with same filename in two different streams and expect no suffixes for filenames" do
+ post(:combine_selected_files_into_collection, {
+ selection: ['zzzzz-4zz18-znfnqtbbv4spc3w',
+ 'zzzzz-4zz18-foonbarfilesdir'],
+ format: "json"},
+ session_for(:active))
+
+ assert_response 302 # collection created and redirected to new collection page
+
+ assert response.headers['Location'].include? '/collections/'
+ new_collection_uuid = response.headers['Location'].split('/')[-1]
+
+ use_token :active
+ collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first
+ manifest_text = collection['manifest_text']
+
+ streams = manifest_text.split "\n"
+ assert_equal 2, streams.length
+ streams.each do |stream|
+ if stream.start_with? './dir1'
+ assert stream.include?('foo'), 'Not found: foo in dir1'
+ elsif stream.start_with? '. '
+ assert stream.include?('foo'), 'Not found: foo in .'
+ end
+ end
+ assert !manifest_text.include?('foo(1)'), 'Found foo(1) in new collection manifest text'
+ end
+
+ test "combine foo files from two different collection streams and expect proper filename suffixes" do
+ post(:combine_selected_files_into_collection, {
+ selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
+ 'zzzzz-4zz18-foonbarfilesdir/dir1/foo'],
+ format: "json"},
+ session_for(:active))
+
+ assert_response 302 # collection created and redirected to new collection page
+
+ assert response.headers['Location'].include? '/collections/'
+ new_collection_uuid = response.headers['Location'].split('/')[-1]
+
+ use_token :active
+ collection = Collection.select([:uuid, :manifest_text]).where(uuid: new_collection_uuid).first
+ manifest_text = collection['manifest_text']
+
+ streams = manifest_text.split "\n"
+ assert_equal 1, streams.length
+ assert manifest_text.include?('foo'), 'Found foo in new collection manifest text'
+ assert manifest_text.include?('foo(1)'), 'Found foo(1) in new collection manifest text'
+ end
end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 2201225..f3e5cb3 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -470,6 +470,43 @@ collection_with_one_property:
properties:
property1: value1
+# The following three collections are used to test combining collections with repeated filenames
+collection_with_repeated_filenames_and_contents_in_two_dirs_1:
+ uuid: zzzzz-4zz18-duplicatenames1
+ portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ name: collection_with_repeated_filenames_and_contents_in_two_dirs_1
+ manifest_text: "./dir1 92b53930db60fe94be2a73fc771ba921+34+Af966b611a1e6a7df18e0f20ac742a255c27744b7 at 550a3f11 0:12:alice 12:12:alice.txt 24:10:bob.txt\n./dir2 56ac2557b1ded11ccab7293dc47d1e88+44+A1780092551dadcb9c74190a793a779cea84d632d at 550a3f11 0:27:alice.txt\n"
+
+collection_with_repeated_filenames_and_contents_in_two_dirs_2:
+ uuid: zzzzz-4zz18-duplicatenames2
+ portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ name: collection_with_repeated_filenames_and_contents_in_two_dirs_2
+ manifest_text: "./dir1 92b53930db60fe94be2a73fc771ba921+34+Af966b611a1e6a7df18e0f20ac742a255c27744b7 at 550a3f11 0:12:alice 12:12:alice.txt 24:10:carol.txt\n./dir2 56ac2557b1ded11ccab7293dc47d1e88+44+A1780092551dadcb9c74190a793a779cea84d632d at 550a3f11 0:27:alice.txt\n"
+
+foo_and_bar_files_in_dir:
+ uuid: zzzzz-4zz18-foonbarfilesdir
+ portable_data_hash: 6bbac24198d09a93975f60098caf0bdf+62
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ name: foo_file_in_dir
+ manifest_text: "./dir1 a84b928ebdbae3f658518c711beaec02+28+A0cff02249e70e8cd6e55dba49fef4afa3f5bfdfb at 550acd28 0:3:bar 12:16:foo\n"
+
# Test Helper trims the rest of the file
# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list