[ARVADOS] updated: a12864a31d5569c74ed32157d5fe928a1c2563b7

Git user git at public.curoverse.com
Fri Dec 30 15:17:57 EST 2016


Summary of changes:
 .../app/controllers/projects_controller.rb         |  10 +-
 .../test/controllers/projects_controller_test.rb   |   9 +-
 sdk/go/arvados/collection.go                       |   4 +-
 sdk/go/arvados/resource_list.go                    |  11 +-
 .../arvados/v1/collections_controller.rb           |  30 ++++-
 services/api/app/middlewares/rack_socket.rb        |  20 ++-
 services/api/app/models/arvados_model.rb           |   2 +-
 services/api/app/models/collection.rb              |  98 ++++++++++++---
 services/api/config/application.default.yml        |   9 +-
 services/api/config/routes.rb                      |   1 +
 ...61222153434_split_expiry_to_trash_and_delete.rb |  42 +++++++
 services/api/db/structure.sql                      |  45 +++++--
 services/api/lib/eventbus.rb                       |   1 +
 services/api/lib/load_param.rb                     |   3 +-
 services/api/lib/sweep_trashed_collections.rb      |  34 +++++
 services/api/test/fixtures/collections.yml         |  41 +++++-
 .../arvados/v1/collections_controller_test.rb      |  65 ++++++++++
 services/api/test/integration/select_test.rb       |   7 ++
 services/api/test/unit/collection_test.rb          | 140 +++++++++++++++++++--
 services/arv-web/arv-web.py                        |   2 +-
 services/crunch-run/crunchrun.go                   |   4 +-
 services/keep-balance/balance_run_test.go          |   5 +-
 services/keep-balance/collection.go                |  22 ++--
 23 files changed, 530 insertions(+), 75 deletions(-)
 create mode 100644 services/api/db/migrate/20161222153434_split_expiry_to_trash_and_delete.rb
 create mode 100644 services/api/lib/sweep_trashed_collections.rb

       via  a12864a31d5569c74ed32157d5fe928a1c2563b7 (commit)
       via  29246b83f1b1c66eb12ed53c844ef37ee0b77568 (commit)
       via  9c7a9a6e4660b3e7cc6419e5818ffaa3a78b6d19 (commit)
       via  7d6cb0405504a536a88aa8467e474f7fd13299a7 (commit)
       via  d02ba63331267f782e0bc5868ca4aab456e0f2b4 (commit)
       via  6cec281e8653731602ab871cc41ddd21ca8182ab (commit)
       via  4ee5a6efb8b01afddddaa8ce5ed7d0de42a287d6 (commit)
       via  eebb0457f1bb69ec2084cbefcbff8c19e404d556 (commit)
       via  0aa01993bc8533d417dc510b1860a4a583e093b4 (commit)
       via  cdd8dc7bc4cca452e25c5b014e5f2bb592fb31ce (commit)
      from  b9df977af1ca8d7fe942cbe13956fa19ed88b91d (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 a12864a31d5569c74ed32157d5fe928a1c2563b7
Merge: b9df977 29246b8
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 15:17:02 2016 -0500

    Merge branch '10538-trash-delete' closes #10538


commit 29246b83f1b1c66eb12ed53c844ef37ee0b77568
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 15:16:31 2016 -0500

    10538: Mention fixture names in comments when not using fixture finders.

diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 192ed17..2eb873b 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -221,6 +221,8 @@ collection_to_move_around_in_aproject:
   manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
   name: collection_to_move_around
 
+# Note: collections(:expired_collection) fixture finder won't work
+# because it is not in default scope
 expired_collection:
   uuid: zzzzz-4zz18-mto52zx1s7sn3ih
   portable_data_hash: 0b21a217243bfce5617fb9224b95bcb9+49
@@ -251,6 +253,8 @@ trashed_on_next_sweep:
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:expired\n"
   name: trashed_on_next_sweep
 
+# Note: collections(:deleted_on_next_sweep) fixture finder won't work
+# because it is not in default scope
 deleted_on_next_sweep:
   uuid: zzzzz-4zz18-3u1p5umicfpqszp
   portable_data_hash: 0b21a217243bfce5617fb9224b95bcb9+49
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index bd331c3..eeeedce 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -933,7 +933,7 @@ EOS
   end
 
   test 'get trashed collection with include_trash' do
-    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
     get :show, {
       id: uuid,
@@ -943,7 +943,7 @@ EOS
   end
 
   test 'get trashed collection without include_trash' do
-    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
     get :show, {
       id: uuid,
@@ -964,7 +964,7 @@ EOS
   end
 
   test 'delete long-trashed collection immediately using http DELETE verb' do
-    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+    uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
     authorize_with :active
     delete :destroy, {
       id: uuid,
@@ -975,10 +975,15 @@ EOS
     assert_operator c.delete_at, :<, db_current_time
   end
 
-  ['zzzzz-4zz18-mto52zx1s7sn3ih',
-   'zzzzz-4zz18-5qa38qghh1j3nvv',
-  ].each do |uuid|
-    test "trash collection #{uuid} via trash action with grace period" do
+  ['zzzzz-4zz18-mto52zx1s7sn3ih', # expired_collection
+   :empty_collection_name_in_active_user_home_project,
+  ].each do |fixture|
+    test "trash collection #{fixture} via trash action with grace period" do
+      if fixture.is_a? String
+        uuid = fixture
+      else
+        uuid = collections(fixture).uuid
+      end
       authorize_with :active
       time_before_trashing = db_current_time
       post :trash, {
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index d1cb978..4984aad 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -470,9 +470,8 @@ class CollectionTest < ActiveSupport::TestCase
   end
 
   test "move to trash in SweepTrashedCollections" do
-    uuid = 'zzzzz-4zz18-4guozfh77ewd2f0'
-    c = Collection.where('uuid=? and is_trashed=false', uuid).first
-    assert c
+    c = collections(:trashed_on_next_sweep)
+    refute_empty Collection.where('uuid=? and is_trashed=false', c.uuid)
     assert_raises(ActiveRecord::RecordNotUnique) do
       act_as_user users(:active) do
         Collection.create!(owner_uuid: c.owner_uuid,
@@ -480,8 +479,8 @@ class CollectionTest < ActiveSupport::TestCase
       end
     end
     SweepTrashedCollections.sweep_now
-    c = Collection.unscoped.find_by_uuid(uuid)
-    assert_equal true, c.is_trashed
+    c = Collection.unscoped.where('uuid=? and is_trashed=true', c.uuid).first
+    assert c
     act_as_user users(:active) do
       assert Collection.create!(owner_uuid: c.owner_uuid,
                                 name: c.name)
@@ -489,7 +488,7 @@ class CollectionTest < ActiveSupport::TestCase
   end
 
   test "delete in SweepTrashedCollections" do
-    uuid = 'zzzzz-4zz18-3u1p5umicfpqszp'
+    uuid = 'zzzzz-4zz18-3u1p5umicfpqszp' # deleted_on_next_sweep
     assert_not_empty Collection.unscoped.where(uuid: uuid)
     SweepTrashedCollections.sweep_now
     assert_empty Collection.unscoped.where(uuid: uuid)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list