[ARVADOS] updated: 081ffd25912e960854427a7c0531c6dbb78d1b4c

git at public.curoverse.com git at public.curoverse.com
Thu Sep 25 13:10:24 EDT 2014


Summary of changes:
 services/api/test/fixtures/logs.yml                |  9 ++++++
 .../functional/arvados/v1/jobs_controller_test.rb  | 37 ++++++++++++----------
 .../functional/arvados/v1/logs_controller_test.rb  | 11 +++++--
 3 files changed, 38 insertions(+), 19 deletions(-)

       via  081ffd25912e960854427a7c0531c6dbb78d1b4c (commit)
       via  586b30b8171da19a4d777c6c2edf4cd7f2fdecfe (commit)
       via  ef6972c6f0e42266220d3d256f69f817f559bf2c (commit)
      from  48694918fb3e78857d921766784f04cc49dc1ab1 (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 081ffd25912e960854427a7c0531c6dbb78d1b4c
Author: radhika <radhika at curoverse.com>
Date:   Thu Sep 25 12:54:35 2014 -0400

    3889: split the test "update a job without failing script_version check" into two tests instead of two action in one test.

diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index 03ee3df..ca6112a 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -102,22 +102,17 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     assert_not_nil job['cancelled_at'], 'un-cancelled job stays cancelled'
   end
 
-  test "update a job without failing script_version check" do
-    authorize_with :admin
-    put :update, {
-      id: jobs(:uses_nonexistent_script_version).uuid,
-      job: {
-        owner_uuid: users(:admin).uuid
-      }
-    }
-    assert_response :success
-    put :update, {
-      id: jobs(:uses_nonexistent_script_version).uuid,
-      job: {
-        owner_uuid: users(:active).uuid
+  ['admin', 'active'].each do |user|
+    test "#{user} update a job without failing script_version check" do
+      authorize_with :admin
+      put :update, {
+        id: jobs(:uses_nonexistent_script_version).uuid,
+        job: {
+          owner_uuid: users(user).uuid
+        }
       }
-    }
-    assert_response :success
+      assert_response :success
+    end
   end
 
   test "search jobs by uuid with >= query" do

commit 586b30b8171da19a4d777c6c2edf4cd7f2fdecfe
Author: radhika <radhika at curoverse.com>
Date:   Thu Sep 25 12:32:55 2014 -0400

    3889: split the test "cancel a running job" into two tests: one that cancels a running job and another that cancels an already cancelled job.

diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index a9a49a0..03ee3df 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -81,9 +81,19 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     assert_equal(true,
                  File.exists?(Rails.configuration.crunch_refresh_trigger),
                  'trigger file should be created when job is cancelled')
+  end
+
+  test "cancelling a cancelled jobs stays cancelled" do
+    # We need to verify that "cancel" creates a trigger file, so first
+    # let's make sure there is no stale trigger file.
+    begin
+      File.unlink(Rails.configuration.crunch_refresh_trigger)
+    rescue Errno::ENOENT
+    end
 
+    authorize_with :active
     put :update, {
-      id: jobs(:running).uuid,
+      id: jobs(:running_cancelled).uuid,
       job: {
         cancelled_at: nil
       }

commit ef6972c6f0e42266220d3d256f69f817f559bf2c
Author: radhika <radhika at curoverse.com>
Date:   Thu Sep 25 12:24:10 2014 -0400

    3889: split test doing post and get requests into two different tests by using a fixture.

diff --git a/services/api/test/fixtures/logs.yml b/services/api/test/fixtures/logs.yml
index 15945cc..058c387 100644
--- a/services/api/test/fixtures/logs.yml
+++ b/services/api/test/fixtures/logs.yml
@@ -35,3 +35,12 @@ log5: # baz collection added, readable by active and spectator through group 'al
   object_uuid: zzzzz-4zz18-y9vne9npefyxh8g # baz file
   object_owner_uuid: zzzzz-tpzed-000000000000000 # system user
   event_at: <%= 5.minute.ago.to_s(:db) %>
+
+log_owned_by_active:
+  id: 6
+  uuid: zzzzz-xxxxx-pshmckwoma12345
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz # active user
+  object_uuid: zzzzz-2x53u-382brsig8rp3667 # repository foo
+  object_owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz # active user
+  event_at: <%= 2.minute.ago.to_s(:db) %>
+  summary: non-admin use can read own logs
diff --git a/services/api/test/functional/arvados/v1/logs_controller_test.rb b/services/api/test/functional/arvados/v1/logs_controller_test.rb
index a224e25..96daa5b 100644
--- a/services/api/test/functional/arvados/v1/logs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/logs_controller_test.rb
@@ -3,15 +3,20 @@ require 'test_helper'
 class Arvados::V1::LogsControllerTest < ActionController::TestCase
   fixtures :logs
 
-  test "non-admins can read their own logs" do
+  test "non-admins can create their own logs" do
     authorize_with :active
     post :create, log: {summary: "test log"}
     assert_response :success
     uuid = JSON.parse(@response.body)['uuid']
     assert_not_nil uuid
-    get :show, {id: uuid}
+  end
+
+  test "non-admins can read their own logs" do
+    authorize_with :active
+    my_log = logs(:log_owned_by_active)
+    get :show, {id: my_log[:uuid]}
     assert_response(:success, "failed to load created log")
-    assert_equal("test log", assigns(:object).summary,
+    assert_equal(my_log[:summary], assigns(:object).summary,
                  "loaded wrong log after creation")
   end
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list