[ARVADOS] updated: 927f967049c054e41ef4ad51b7eb3dfd631fe2ce

git at public.curoverse.com git at public.curoverse.com
Wed Jan 14 12:56:11 EST 2015


Summary of changes:
 .../api/test/integration/collections_api_test.rb   | 48 ++++++++--------------
 services/api/test/unit/collection_test.rb          | 26 +++++++-----
 2 files changed, 34 insertions(+), 40 deletions(-)

       via  927f967049c054e41ef4ad51b7eb3dfd631fe2ce (commit)
      from  3fa179311344ed08b9bb8df113fb7901eac13ee7 (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 927f967049c054e41ef4ad51b7eb3dfd631fe2ce
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Wed Jan 14 12:54:41 2015 -0500

    4523: check for a specific file name and stream names in file_names.

diff --git a/services/api/test/integration/collections_api_test.rb b/services/api/test/integration/collections_api_test.rb
index 8193213..d8376c5 100644
--- a/services/api/test/integration/collections_api_test.rb
+++ b/services/api/test/integration/collections_api_test.rb
@@ -133,57 +133,46 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     assert_equal 'a name', json_response['name']
   end
 
-  test "create collection, update description, and search for description" do
-    signing_opts = {
-      key: Rails.configuration.blob_signing_key,
-      api_token: api_token(:active),
-    }
-    signed_locator = Blob.sign_locator('bad42fa702ae1234d999fef11b46f450+44', signing_opts)
+  test "update description for a collection, and search for that description" do
+    collection = collections(:multilevel_collection_1)
 
-    # create collection
-    post "/arvados/v1/collections", {
+    # update collection's description
+    put "/arvados/v1/collections/#{collection['uuid']}", {
       format: :json,
-      collection: "{\"manifest_text\":\". #{signed_locator} 0:44:foo.txt\\n\"}"
+      collection: { description: "something specific" }
     }, auth(:active)
     assert_response :success
-    assert_equal '087e2f211aba2881c08fd8d1646522a3+51', json_response['portable_data_hash']
+    assert_equal 'something specific', json_response['description']
 
-    # update collection's description
-    put "/arvados/v1/collections/#{json_response['uuid']}", {
+    # get the collection and verify newly added description
+    get "/arvados/v1/collections/#{collection['uuid']}", {
       format: :json,
-      collection: { description: "something specific" }
     }, auth(:active)
-    assert_response :success
+    assert_response 200
     assert_equal 'something specific', json_response['description']
-    assert_equal '087e2f211aba2881c08fd8d1646522a3+51', json_response['portable_data_hash']
 
     # search
-    search_using_filter 'specific', 1, '087e2f211aba2881c08fd8d1646522a3+51'
-    search_using_filter 'not specific enough', 0, nil
+    search_using_filter 'specific', 1
+    search_using_filter 'not specific enough', 0
   end
 
   test "create collection, update manifest, and search with filename" do
-    signing_opts = {
-      key: Rails.configuration.blob_signing_key,
-      api_token: api_token(:active),
-    }
-    signed_locator = Blob.sign_locator('bad42fa702ae3ea7d999fef11b46f450+44', signing_opts)
-
     # create collection
+    signed_locator = Collection.sign_manifest("0:44:my_test_file.txt\n", api_token(:active))
     post "/arvados/v1/collections", {
       format: :json,
       collection: "{\"manifest_text\":\". #{signed_locator} 0:44:my_test_file.txt\\n\"}"
     }, auth(:active)
     assert_response :success
     assert_equal true, json_response['manifest_text'].include?('my_test_file.txt')
-    assert_equal '0f99f4087beb13dec46d36db9fa6cebf+60', json_response['portable_data_hash']
 
     created = json_response
 
     # search using the filename
-    search_using_filter 'my_test_file.txt', 1, '0f99f4087beb13dec46d36db9fa6cebf+60'
+    search_using_filter 'my_test_file.txt', 1
 
     # update the collection's manifest text
+    signed_locator = Collection.sign_manifest("0:44:my_updated_test_file.txt\n", api_token(:active))
     put "/arvados/v1/collections/#{created['uuid']}", {
       format: :json,
       collection: "{\"manifest_text\":\". #{signed_locator} 0:44:my_updated_test_file.txt\\n\"}"
@@ -194,12 +183,12 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     assert_equal false, json_response['manifest_text'].include?('my_test_file.txt')
 
     # search using the new filename
-    search_using_filter 'my_updated_test_file.txt', 1, '17d7d7e6f09ae17e3b580143586a1a3f+68'
-    search_using_filter 'my_test_file.txt', 0, nil
-    search_using_filter 'there_is_no_such_file.txt', 0, nil
+    search_using_filter 'my_updated_test_file.txt', 1
+    search_using_filter 'my_test_file.txt', 0
+    search_using_filter 'there_is_no_such_file.txt', 0
   end
 
-  def search_using_filter search_filter, expected_items, pdh
+  def search_using_filter search_filter, expected_items
     get '/arvados/v1/collections', {
       where: { any: ['contains', search_filter] }
     }, auth(:active)
@@ -213,7 +202,6 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
       assert_equal expected_items, response_items.size
       first_item = response_items.first
       assert_not_nil first_item
-      assert_equal pdh, first_item['portable_data_hash']
     end
   end
 end
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index 0134ec2..16d041b 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -45,33 +45,39 @@ class CollectionTest < ActiveSupport::TestCase
       assert c.valid?
       created_file_names = c.file_names
       assert created_file_names
+      assert_match /foo.txt/, c.file_names
 
       c.update_attribute 'manifest_text', ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo2.txt\n"
       assert_not_equal created_file_names, c.file_names
+      assert_match /foo2.txt/, c.file_names
     end
   end
 
   [
-    2**8,
-    2**18,
-  ].each do |manifest_size|
-    test "create collection with manifest size #{manifest_size} and
-          not expect exceptions even on very large manifest texts" do
+    [2**8, false],
+    [2**18, true],
+  ].each do |manifest_size, gets_truncated|
+    test "create collection with manifest size #{manifest_size} which gets truncated #{gets_truncated},
+          and not expect exceptions even on very large manifest texts" do
       # file_names has a max size, hence there will be no errors even on large manifests
       act_as_system_user do
-        manifest_text = '. d41d8cd98f00b204e9800998ecf8427e+0'
+        manifest_text = './blurfl d41d8cd98f00b204e9800998ecf8427e+0'
         index = 0
         while manifest_text.length < manifest_size
-          manifest_text += ' ' + "0:0:veryverylongfilename000000000000#{index}.txt"
+          manifest_text += ' ' + "0:0:veryverylongfilename000000000000#{index}.txt\n./subdir1"
           index += 1
         end
         manifest_text += "\n"
-
         c = Collection.create(manifest_text: manifest_text)
 
         assert c.valid?
-        created_file_names = c.file_names
-        assert created_file_names
+        assert c.file_names
+        assert_match /veryverylongfilename0000000000001.txt/, c.file_names
+        assert_match /veryverylongfilename0000000000002.txt/, c.file_names
+        if !gets_truncated
+          assert_match /blurfl/, c.file_names
+          assert_match /subdir1/, c.file_names
+        end
       end
     end
   end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list