[ARVADOS] updated: 1.1.3-255-g5f46323

Git user git at public.curoverse.com
Mon Apr 2 15:12:28 EDT 2018


Summary of changes:
 services/api/lib/sweep_trashed_objects.rb |  2 +-
 services/api/test/fixtures/jobs.yml       |  2 +-
 services/api/test/unit/group_test.rb      | 15 +++++++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

       via  5f463235cefa6a0c566ff3f0d71f09e0d3be2fce (commit)
       via  aebdddd8d1449ff7f8a6ba63054276e798dd79a0 (commit)
      from  fea63ac8216b2a15101bc75cd02586d934897160 (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 5f463235cefa6a0c566ff3f0d71f09e0d3be2fce
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Mon Apr 2 16:11:56 2018 -0300

    12414: Test fixes
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb
index 857662a..59008c0 100644
--- a/services/api/lib/sweep_trashed_objects.rb
+++ b/services/api/lib/sweep_trashed_objects.rb
@@ -20,7 +20,7 @@ module SweepTrashedObjects
     # exceptions, and delete records owned by this project
     skipped_classes = ['Group', 'User']
     ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |klass|
-      if !skipped_classes.include?(klass.name) && klass.columns.collect{&:name}.include?('owner_uuid')
+      if !skipped_classes.include?(klass.name) && klass.columns.collect(&:name).include?('owner_uuid')
         klass.where({owner_uuid: p_uuid}).destroy_all
       end
     end
diff --git a/services/api/test/unit/group_test.rb b/services/api/test/unit/group_test.rb
index 554106e..8b3052e 100644
--- a/services/api/test/unit/group_test.rb
+++ b/services/api/test/unit/group_test.rb
@@ -206,9 +206,9 @@ class GroupTest < ActiveSupport::TestCase
     # Save how many objects were before the sweep
     user_nr_was = User.all.length
     coll_nr_was = Collection.all.length
-    group_nr_was = Group.where('group_class != "project"').length
-    project_nr_was = Group.where(group_class: "project").length
-    cr_nr_was = CollectionRequest.all.length
+    group_nr_was = Group.where('group_class<>?', 'project').length
+    project_nr_was = Group.where(group_class: 'project').length
+    cr_nr_was = ContainerRequest.all.length
     job_nr_was = Job.all.length
     assert_not_empty Group.where(uuid: g_foo.uuid)
     assert_not_empty Group.where(uuid: g_bar.uuid)
@@ -225,10 +225,11 @@ class GroupTest < ActiveSupport::TestCase
     assert_empty ContainerRequest.where(uuid: cr.uuid)
     # No unwanted deletions should have happened
     assert_equal user_nr_was, User.all.length
-    assert_equal coll_nr_was-1, Collection.all.length
-    assert_equal group_nr_was, Group.where('group_class != "project"').length
-    assert_equal project_nr_was-3, Group.where(group_class: "project").length
-    assert_equal cr_nr_was-1, CollectionRequest.all.length
+    assert_equal coll_nr_was-2,        # collection_in_trashed_subproject
+                 Collection.all.length # & deleted_on_next_sweep collections
+    assert_equal group_nr_was, Group.where('group_class<>?', 'project').length
+    assert_equal project_nr_was-3, Group.where(group_class: 'project').length
+    assert_equal cr_nr_was-1, ContainerRequest.all.length
     assert_equal job_nr_was-1, Job.all.length
   end
 end

commit aebdddd8d1449ff7f8a6ba63054276e798dd79a0
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Mon Apr 2 15:53:40 2018 -0300

    12414: Enhance sweep process test to ensure no unwanted deletions happen
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb
index c4db856..857662a 100644
--- a/services/api/lib/sweep_trashed_objects.rb
+++ b/services/api/lib/sweep_trashed_objects.rb
@@ -20,7 +20,7 @@ module SweepTrashedObjects
     # exceptions, and delete records owned by this project
     skipped_classes = ['Group', 'User']
     ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |klass|
-      if !skipped_classes.include?(klass.name) && klass.columns.collect{|c| c.name}.include?('owner_uuid')
+      if !skipped_classes.include?(klass.name) && klass.columns.collect{&:name}.include?('owner_uuid')
         klass.where({owner_uuid: p_uuid}).destroy_all
       end
     end
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 4b26edc..140f370 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -418,7 +418,7 @@ job_in_subproject:
 job_in_trashed_project:
   uuid: zzzzz-8i9sb-subprojectjob02
   created_at: 2014-10-15 12:00:00
-  owner_uuid: zzzzz-j7d0g-trashedproject1
+  owner_uuid: zzzzz-j7d0g-trashedproject2
   log: ~
   repository: active/foo
   script: hash
diff --git a/services/api/test/unit/group_test.rb b/services/api/test/unit/group_test.rb
index 892086b..554106e 100644
--- a/services/api/test/unit/group_test.rb
+++ b/services/api/test/unit/group_test.rb
@@ -203,6 +203,13 @@ class GroupTest < ActiveSupport::TestCase
     col = collections(:collection_in_trashed_subproject)
     job = jobs(:job_in_trashed_project)
     cr = container_requests(:cr_in_trashed_project)
+    # Save how many objects were before the sweep
+    user_nr_was = User.all.length
+    coll_nr_was = Collection.all.length
+    group_nr_was = Group.where('group_class != "project"').length
+    project_nr_was = Group.where(group_class: "project").length
+    cr_nr_was = CollectionRequest.all.length
+    job_nr_was = Job.all.length
     assert_not_empty Group.where(uuid: g_foo.uuid)
     assert_not_empty Group.where(uuid: g_bar.uuid)
     assert_not_empty Group.where(uuid: g_baz.uuid)
@@ -216,5 +223,12 @@ class GroupTest < ActiveSupport::TestCase
     assert_empty Collection.where(uuid: col.uuid)
     assert_empty Job.where(uuid: job.uuid)
     assert_empty ContainerRequest.where(uuid: cr.uuid)
+    # No unwanted deletions should have happened
+    assert_equal user_nr_was, User.all.length
+    assert_equal coll_nr_was-1, Collection.all.length
+    assert_equal group_nr_was, Group.where('group_class != "project"').length
+    assert_equal project_nr_was-3, Group.where(group_class: "project").length
+    assert_equal cr_nr_was-1, CollectionRequest.all.length
+    assert_equal job_nr_was-1, Job.all.length
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list