[ARVADOS] updated: 6381b9e85f278b0c8cb45ffccd89ca1b1bc4d3ee
git at public.curoverse.com
git at public.curoverse.com
Sun Mar 22 02:25:00 EDT 2015
Summary of changes:
.../app/assets/javascripts/job_log_graph.js | 76 ++++++++++++-------
.../controllers/application_controller_test.rb | 4 +-
.../controllers/collections_controller_test.rb | 2 +-
apps/workbench/test/integration/websockets_test.rb | 87 ++++++++++++----------
services/api/lib/simulate_job_log.rb | 10 ++-
services/api/test/fixtures/logs.yml | 29 ++++++--
.../api_client_authorizations_scopes_test.rb | 2 +-
services/api/test/integration/websocket_test.rb | 8 +-
services/api/test/unit/log_test.rb | 45 +++++++----
9 files changed, 166 insertions(+), 97 deletions(-)
via 6381b9e85f278b0c8cb45ffccd89ca1b1bc4d3ee (commit)
via df9955d76e3103e747360d2c27914d79b97fdf6f (commit)
via 5cb7bacb7326d1aae1b5b323614d6b46d93d0e99 (commit)
via a6ea50199a4aef32094bb6c4e91aa702c02aaca0 (commit)
via ab9955f1ab1aef27b3eecf5d739bf0934d29cdfd (commit)
via b4e040f6864ba10b19009e21744119194a86567f (commit)
via 52f124ea43c941d8500a365945fb9bd9b4b99177 (commit)
from a51029fa0b4466ac4f5dff204f5e1977753a88ad (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 6381b9e85f278b0c8cb45ffccd89ca1b1bc4d3ee
Merge: a51029f df9955d
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Mar 21 16:37:00 2015 -0400
Merge branch '5276-job-graph-phantom-tooltip' closes #5276
commit df9955d76e3103e747360d2c27914d79b97fdf6f
Merge: 5cb7bac a307f4b
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Mar 21 16:19:09 2015 -0400
5276: Merge branch 'master' into 5276-job-graph-phantom-tooltip
commit 5cb7bacb7326d1aae1b5b323614d6b46d93d0e99
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Mar 21 16:19:03 2015 -0400
5276: Name log fixtures. Fix over-sensitive test.
diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index 843cf88..4721316 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -212,7 +212,7 @@ class ApplicationControllerTest < ActionController::TestCase
ac = ApplicationController.new
- uuid = api_fixture('logs')['log4']['object_uuid']
+ uuid = api_fixture('logs')['system_adds_foo_file']['object_uuid']
collections = ac.send :log_collections_for_object, uuid
@@ -227,7 +227,7 @@ class ApplicationControllerTest < ActionController::TestCase
ac = ApplicationController.new
- uuid1 = api_fixture('logs')['log4']['object_uuid']
+ uuid1 = api_fixture('logs')['system_adds_foo_file']['object_uuid']
uuid2 = api_fixture('collections')['bar_file']['uuid']
uuids = [uuid1, uuid2]
diff --git a/apps/workbench/test/controllers/collections_controller_test.rb b/apps/workbench/test/controllers/collections_controller_test.rb
index dfbe69f..9ee26d9 100644
--- a/apps/workbench/test/controllers/collections_controller_test.rb
+++ b/apps/workbench/test/controllers/collections_controller_test.rb
@@ -106,7 +106,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "viewing a collection fetches logs about it" do
show_collection(:foo_file, :active)
assert_includes(assigns(:logs).map(&:uuid),
- api_fixture('logs')['log4']['uuid'],
+ api_fixture('logs')['system_adds_foo_file']['uuid'],
"controller did not find related log")
end
diff --git a/services/api/test/fixtures/logs.yml b/services/api/test/fixtures/logs.yml
index 9862700..06f7a02 100644
--- a/services/api/test/fixtures/logs.yml
+++ b/services/api/test/fixtures/logs.yml
@@ -1,10 +1,10 @@
-log1:
+noop:
id: 1
uuid: zzzzz-xxxxx-pshmckwoma9plh7
object_uuid: zzzzz-tpzed-l1s2piq4t4mps8r
event_at: <%= 1.minute.ago.to_s(:db) %>
-log2: # admin changes repository2, which is owned by active user
+admin_changes_repository2: # admin changes repository2, which is owned by active user
id: 2
uuid: zzzzz-xxxxx-pshmckwoma00002
owner_uuid: zzzzz-tpzed-d9tiejq69daie8f # admin user
@@ -12,7 +12,7 @@ log2: # admin changes repository2, which is owned by active user
object_owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz # active user
event_at: <%= 2.minute.ago.to_s(:db) %>
-log3: # admin changes specimen owned_by_spectator
+admin_changes_specimen: # admin changes specimen owned_by_spectator
id: 3
uuid: zzzzz-xxxxx-pshmckwoma00003
owner_uuid: zzzzz-tpzed-d9tiejq69daie8f # admin user
@@ -20,7 +20,7 @@ log3: # admin changes specimen owned_by_spectator
object_owner_uuid: zzzzz-tpzed-l1s2piq4t4mps8r # spectator user
event_at: <%= 3.minute.ago.to_s(:db) %>
-log4: # foo collection added, readable by active through link
+system_adds_foo_file: # foo collection added, readable by active through link
id: 4
uuid: zzzzz-xxxxx-pshmckwoma00004
owner_uuid: zzzzz-tpzed-000000000000000 # system user
@@ -28,7 +28,7 @@ log4: # foo collection added, readable by active through link
object_owner_uuid: zzzzz-tpzed-000000000000000 # system user
event_at: <%= 4.minute.ago.to_s(:db) %>
-log5: # baz collection added, readable by active and spectator through group 'all users' group membership
+system_adds_baz: # baz collection added, readable by active and spectator through group 'all users' group membership
id: 5
uuid: zzzzz-xxxxx-pshmckwoma00005
owner_uuid: zzzzz-tpzed-000000000000000 # system user
@@ -46,6 +46,7 @@ log_owned_by_active:
summary: non-admin use can read own logs
crunchstat_for_running_job:
+ id: 7
uuid: zzzzz-57u5n-tmymyrojrbtnxh1
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
modified_by_client_uuid: zzzzz-ozdt8-obw7foaks3qjyej
diff --git a/services/api/test/integration/api_client_authorizations_scopes_test.rb b/services/api/test/integration/api_client_authorizations_scopes_test.rb
index 20f83dc..beef195 100644
--- a/services/api/test/integration/api_client_authorizations_scopes_test.rb
+++ b/services/api/test/integration/api_client_authorizations_scopes_test.rb
@@ -63,7 +63,7 @@ class Arvados::V1::ApiTokensScopeTest < ActionController::IntegrationTest
req_args = [{}, auth(:admin_noscope)]
get(v1_url('logs'), *req_args)
assert_response 403
- get(v1_url('logs', logs(:log1).uuid), *req_args)
+ get(v1_url('logs', logs(:noop).uuid), *req_args)
assert_response 403
post(v1_url('logs'), *req_args)
assert_response 403
diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index d5808d8..9179acd 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -283,7 +283,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
authorize_with :admin
- lastid = logs(:log3).id
+ lastid = logs(:admin_changes_specimen).id
l1 = nil
l2 = nil
@@ -311,11 +311,11 @@ class WebsocketTest < ActionDispatch::IntegrationTest
assert false, "Should not get any more events"
end
end
-
end
- assert_equal logs(:log4).object_uuid, l1
- assert_equal logs(:log5).object_uuid, l2
+ expect_next_logs = Log.where('id > ?', lastid).order('id asc')
+ assert_equal expect_next_logs[0].object_uuid, l1
+ assert_equal expect_next_logs[1].object_uuid, l2
end
test "connect, subscribe, get event, unsubscribe" do
diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb
index d6b76fc..22808c5 100644
--- a/services/api/test/unit/log_test.rb
+++ b/services/api/test/unit/log_test.rb
@@ -233,25 +233,40 @@ class LogTest < ActiveSupport::TestCase
end
test "use ownership and permission links to determine which logs a user can see" do
+ known_logs = [:noop,
+ :admin_changes_repository2,
+ :admin_changes_specimen,
+ :system_adds_foo_file,
+ :system_adds_baz,
+ :log_owned_by_active,
+ :crunchstat_for_running_job]
+
c = Log.readable_by(users(:admin)).order("id asc").each.to_a
- assert_equal 6, c.size
- assert_equal 1, c[0].id # no-op
- assert_equal 2, c[1].id # admin changes repository foo, which is owned by active user
- assert_equal 3, c[2].id # admin changes specimen owned_by_spectator
- assert_equal 4, c[3].id # foo collection added, readable by active through link
- assert_equal 5, c[4].id # baz collection added, readable by active and spectator through group 'all users' group membership
- assert_equal 6, c[5].id # log_owned_by_active
+ assert_log_result c, known_logs, known_logs
c = Log.readable_by(users(:active)).order("id asc").each.to_a
- assert_equal 4, c.size
- assert_equal 2, c[0].id # admin changes repository foo, which is owned by active user
- assert_equal 4, c[1].id # foo collection added, readable by active through link
- assert_equal 5, c[2].id # baz collection added, readable by active and spectator through group 'all users' group membership
- assert_equal 6, c[3].id # log_owned_by_active
+ assert_log_result c, known_logs, [:admin_changes_repository2, # owned by active
+ :system_adds_foo_file, # readable via link
+ :system_adds_baz, # readable via 'all users' group
+ :log_owned_by_active, # log owned by active
+ :crunchstat_for_running_job] # log & job owned by active
c = Log.readable_by(users(:spectator)).order("id asc").each.to_a
- assert_equal 2, c.size
- assert_equal 3, c[0].id # admin changes specimen owned_by_spectator
- assert_equal 5, c[1].id # baz collection added, readable by active and spectator through group 'all users' group membership
+ assert_log_result c, known_logs, [:admin_changes_specimen, # owned by spectator
+ :system_adds_baz] # readable via 'all users' group
+ end
+
+ def assert_log_result result, known_logs, expected_logs
+ # All of expected_logs must appear in result. Additional logs can
+ # appear too, but only if they are _not_ listed in known_logs
+ # (i.e., we do not make any assertions about logs not mentioned in
+ # either "known" or "expected".)
+ result_ids = result.collect &:id
+ expected_logs.each do |want|
+ assert_includes result_ids, logs(want).id
+ end
+ (known_logs - expected_logs).each do |notwant|
+ refute_includes result_ids, logs(notwant).id
+ end
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list