[ARVADOS] updated: afcf9c1365f3c158be01c6475a083b6dd38f2f30

Git user git at public.curoverse.com
Fri Dec 30 13:53:23 EST 2016


Summary of changes:
 sdk/go/arvados/collection.go                          |  2 +-
 services/api/app/models/collection.rb                 | 12 +++++++-----
 services/api/test/fixtures/collections.yml            |  4 ++++
 .../arvados/v1/collections_controller_test.rb         | 19 ++++++++++++-------
 services/api/test/unit/collection_test.rb             | 12 ++++++------
 5 files changed, 30 insertions(+), 19 deletions(-)

       via  afcf9c1365f3c158be01c6475a083b6dd38f2f30 (commit)
       via  9c7a9a6e4660b3e7cc6419e5818ffaa3a78b6d19 (commit)
       via  7d6cb0405504a536a88aa8467e474f7fd13299a7 (commit)
       via  d02ba63331267f782e0bc5868ca4aab456e0f2b4 (commit)
      from  6cec281e8653731602ab871cc41ddd21ca8182ab (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 afcf9c1365f3c158be01c6475a083b6dd38f2f30
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 13:50:09 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..3deef02 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -470,9 +470,9 @@ 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
+    ### uuid = 'zzzzz-4zz18-4guozfh77ewd2f0' # trashed_on_next_sweep
+    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 +480,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 +489,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)

commit 9c7a9a6e4660b3e7cc6419e5818ffaa3a78b6d19
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 13:39:07 2016 -0500

    10538: Clarify error message.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 572a717..4f774d6 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -465,7 +465,7 @@ class Collection < ArvadosModel
 
   def validate_trash_and_delete_timing
     if trash_at.nil? != delete_at.nil?
-      errors.add :delete_at, "must be nil if and only if trash_at is nil"
+      errors.add :delete_at, "must be set if trash_at is set, and must be nil otherwise"
     end
 
     earliest_delete = ([@validation_timestamp, trash_at_was].compact.min +

commit 7d6cb0405504a536a88aa8467e474f7fd13299a7
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 13:38:26 2016 -0500

    10538: Clear up default_trash_interval logic

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 93d4620..572a717 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -454,10 +454,12 @@ class Collection < ArvadosModel
   # If trash_at is updated without touching delete_at, automatically
   # update delete_at to a sensible value.
   def default_trash_interval
-    if trash_at && trash_at_changed? && !delete_at_changed?
-      self.delete_at = trash_at + Rails.configuration.default_trash_lifetime.seconds
-    elsif trash_at.nil? && trash_at_changed? && !delete_at_changed?
-      self.delete_at = nil
+    if trash_at_changed? && !delete_at_changed?
+      if trash_at.nil?
+        self.delete_at = nil
+      else
+        self.delete_at = trash_at + Rails.configuration.default_trash_lifetime.seconds
+      end
     end
   end
 

commit d02ba63331267f782e0bc5868ca4aab456e0f2b4
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Dec 30 13:37:41 2016 -0500

    10538: Fix misspelled IsTrash -> IsTrashed

diff --git a/sdk/go/arvados/collection.go b/sdk/go/arvados/collection.go
index 3584d0d..9274238 100644
--- a/sdk/go/arvados/collection.go
+++ b/sdk/go/arvados/collection.go
@@ -21,7 +21,7 @@ type Collection struct {
 	ReplicationConfirmedAt *time.Time `json:"replication_confirmed_at,omitempty"`
 	ReplicationDesired     *int       `json:"replication_desired,omitempty"`
 	DeleteAt               *time.Time `json:"delete_at,omitempty"`
-	IsTrash                bool       `json:"is_trash,omitempty"`
+	IsTrashed              bool       `json:"is_trashed,omitempty"`
 }
 
 // SizedDigests returns the hash+size part of each data block

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list