[ARVADOS] updated: 2.1.0-1643-g3134405eb

Git user git at public.arvados.org
Wed Nov 17 20:36:07 UTC 2021


Summary of changes:
 AUTHORS                                            |   3 +-
 CONTRIBUTING.md                                    |  12 +-
 ...llection-managed-properties.html.textile.liquid |  12 +-
 .../collection-versioning.html.textile.liquid      |   2 +-
 lib/config/export.go                               |   2 +-
 lib/controller/router/response.go                  |   4 +
 lib/controller/router/router_test.go               |  21 ++++
 lib/crunchrun/crunchrun.go                         |   7 +-
 lib/crunchrun/crunchrun_test.go                    |  14 +--
 sdk/cwl/setup.py                                   |   4 +-
 sdk/python/arvados/collection.py                   |  30 ++++-
 sdk/python/setup.py                                |   2 +-
 sdk/python/tests/run_test_server.py                |   1 +
 sdk/python/tests/test_collections.py               |  19 +++
 .../controllers/arvados/v1/groups_controller.rb    |  13 +-
 .../controllers/arvados/v1/schema_controller.rb    |  21 ++++
 .../arvados/v1/groups_controller_test.rb           |  15 +++
 .../api/test/functional/sys_controller_test.rb     | 135 +++++++++++++++++++++
 services/fuse/arvados_fuse/command.py              |   4 +-
 services/fuse/arvados_fuse/fusedir.py              |  93 +++++++++-----
 services/fuse/arvados_fuse/fusefile.py             |   7 +-
 services/fuse/tests/mount_test_base.py             |   7 +-
 services/fuse/tests/test_mount.py                  |  24 +++-
 services/keepstore/unix_volume.go                  |  57 +++++----
 24 files changed, 419 insertions(+), 90 deletions(-)
 create mode 100644 services/api/test/functional/sys_controller_test.rb

       via  3134405ebc155a8a51738b7c6d0d4be348c65087 (commit)
       via  69c08bb019277b158fc2f568b7de7483caa2875d (commit)
       via  cd595132cceecb3ab12af7731f643f3662af54dd (commit)
       via  55b5ec75a3f6c9154778c8836a99db37e3250abf (commit)
       via  a1c3ad1a6a68e893457e93f936d4a8aacc707d87 (commit)
       via  aa3efa4aa2749e9c20f6b889ce5968b84db283ba (commit)
       via  16b8b12040790937b5efa8fbb21522d5f31475b0 (commit)
       via  2a13c742cdca6fbae46a9ce1c6ae044633d03ce3 (commit)
       via  c57327b6428ba6f44f6dd121eeb6e6853c0f7052 (commit)
       via  9d74b115e05fac77b49d080d9c89699b12f3c433 (commit)
       via  43d9cc591e4207501d608d7b2ca1e7687d92825e (commit)
       via  02025c4fde1336313bb1428707245a05bd8b8a29 (commit)
       via  4da9342911fe66e526079d48dfaccbe0f0e396d8 (commit)
       via  5d04b15c92633b926456766f88cd8c6eccdc5fc9 (commit)
       via  153d9954cbe21a0e98bf5cf364898e2bc10fcabd (commit)
       via  6e0b8fe3e7a9ee4834dc454d6f0c5a409590ce6d (commit)
       via  3849ee94bbe65ef79df8f50c87b5445a5b1d4877 (commit)
       via  528b929e84319067df7bc49162307ee82a9d852c (commit)
       via  39ce50e472535737446a54b2187ab4b38727a79c (commit)
       via  b1a88ceac8f65aaf90076827120e233cb52976d6 (commit)
       via  a02b821d78d93bd814d8bf2b8b532b8940e93ecf (commit)
       via  365b9ca0ea4291d9864297593d185aeef66457ba (commit)
       via  a4d47d01dbbca45545353cee14f6a0aa2424c149 (commit)
       via  d3ffe252f9d7cbbad9a7bf61ccf5d26129720f43 (commit)
       via  9f4fd542a9fc94e9f48387e90fd70b614458c1f2 (commit)
       via  a969c0d3e97c2aeff0b64f9f0c8052f71eefa576 (commit)
       via  ee0b90f8e2e9fc75ea810336dc398d8365752e79 (commit)
       via  1c36c7a9d4cb3829e57aab9ac84a6b85ec35459c (commit)
       via  d0a50cd1fafca2a931f35f7997bd40f01a295ee0 (commit)
       via  2437c9eb78db1fbeb5365bd403dc791096a03a2b (commit)
       via  d35c1a7499cabedf0e2b6e592e0abf039fb8450f (commit)
      from  aa3d4030686f5db784dcaf2d7f28225eb98c4267 (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 3134405ebc155a8a51738b7c6d0d4be348c65087
Merge: 69c08bb01 55b5ec75a
Author: Tom Clegg <tom at curii.com>
Date:   Wed Nov 17 15:35:55 2021 -0500

    18339: Merge branch 'main'
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>


commit 69c08bb019277b158fc2f568b7de7483caa2875d
Author: Tom Clegg <tom at curii.com>
Date:   Wed Nov 17 15:35:32 2021 -0500

    18339: Add sys/trash_sweep to discovery doc.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index c1d4b74d6..59ac639ba 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -427,6 +427,27 @@ class Arvados::V1::SchemaController < ApplicationController
         }
       }
 
+      discovery[:resources]['sys'] = {
+        methods: {
+          get: {
+            id: "arvados.sys.trash_sweep",
+            path: "sys/trash_sweep",
+            httpMethod: "POST",
+            description: "apply scheduled trash and delete operations",
+            parameters: {
+            },
+            parameterOrder: [
+            ],
+            response: {
+            },
+            scopes: [
+              "https://api.arvados.org/auth/arvados",
+              "https://api.arvados.org/auth/arvados.readonly"
+            ]
+          },
+        }
+      }
+
       Rails.configuration.API.DisabledAPIs.each do |method, _|
         ctrl, action = method.to_s.split('.', 2)
         discovery[:resources][ctrl][:methods].delete(action.to_sym)

commit cd595132cceecb3ab12af7731f643f3662af54dd
Author: Tom Clegg <tom at curii.com>
Date:   Wed Nov 17 15:34:44 2021 -0500

    18339: Add test cases.
    
    Existing tests ported from other test suites, but missed adding the
    new file in previous commit.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/api/test/functional/sys_controller_test.rb b/services/api/test/functional/sys_controller_test.rb
new file mode 100644
index 000000000..e13d70298
--- /dev/null
+++ b/services/api/test/functional/sys_controller_test.rb
@@ -0,0 +1,135 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'test_helper'
+
+class SysControllerTest < ActionController::TestCase
+  include CurrentApiClient
+  include DbCurrentTime
+
+  test "trash_sweep - delete expired tokens" do
+    assert_not_empty ApiClientAuthorization.where(uuid: api_client_authorizations(:expired).uuid)
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+    assert_empty ApiClientAuthorization.where(uuid: api_client_authorizations(:expired).uuid)
+  end
+
+  test "trash_sweep - fail with non-admin token" do
+    authorize_with :active
+    post :trash_sweep
+    assert_response 403
+  end
+
+  test "trash_sweep - move collections to trash" do
+    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,
+                           name: c.name)
+      end
+    end
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+    c = Collection.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)
+    end
+  end
+
+  test "trash_sweep - delete collections" do
+    uuid = 'zzzzz-4zz18-3u1p5umicfpqszp' # deleted_on_next_sweep
+    assert_not_empty Collection.where(uuid: uuid)
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+    assert_empty Collection.where(uuid: uuid)
+  end
+
+  test "trash_sweep - delete referring links" do
+    uuid = collections(:trashed_on_next_sweep).uuid
+    act_as_system_user do
+      assert_raises ActiveRecord::RecordInvalid do
+        # Cannot create because :trashed_on_next_sweep is already trashed
+        Link.create!(head_uuid: uuid,
+                     tail_uuid: system_user_uuid,
+                     link_class: 'whatever',
+                     name: 'something')
+      end
+
+      # Bump trash_at to now + 1 minute
+      Collection.where(uuid: uuid).
+        update(trash_at: db_current_time + (1).minute)
+
+      # Not considered trashed now
+      Link.create!(head_uuid: uuid,
+                   tail_uuid: system_user_uuid,
+                   link_class: 'whatever',
+                   name: 'something')
+    end
+    past = db_current_time
+    Collection.where(uuid: uuid).
+      update_all(is_trashed: true, trash_at: past, delete_at: past)
+    assert_not_empty Collection.where(uuid: uuid)
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+    assert_empty Collection.where(uuid: uuid)
+  end
+
+  test "trash_sweep - move projects to trash" do
+    p = groups(:trashed_on_next_sweep)
+    assert_empty Group.where('uuid=? and is_trashed=true', p.uuid)
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+    assert_not_empty Group.where('uuid=? and is_trashed=true', p.uuid)
+  end
+
+  test "trash_sweep - delete projects and their contents" do
+    g_foo = groups(:trashed_project)
+    g_bar = groups(:trashed_subproject)
+    g_baz = groups(:trashed_subproject3)
+    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 = 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)
+    assert_not_empty Group.where(uuid: g_baz.uuid)
+    assert_not_empty Collection.where(uuid: col.uuid)
+    assert_not_empty Job.where(uuid: job.uuid)
+    assert_not_empty ContainerRequest.where(uuid: cr.uuid)
+
+    authorize_with :admin
+    post :trash_sweep
+    assert_response :success
+
+    assert_empty Group.where(uuid: g_foo.uuid)
+    assert_empty Group.where(uuid: g_bar.uuid)
+    assert_empty Group.where(uuid: g_baz.uuid)
+    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-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

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list