[ARVADOS] updated: 7d81fa519e768fd3bbafebef1530b1dfc5d845bc
git at public.curoverse.com
git at public.curoverse.com
Fri Aug 15 22:38:05 EDT 2014
Summary of changes:
sdk/python/arvados/commands/keepdocker.py | 1 -
services/api/app/models/collection.rb | 7 +-
services/api/test/fixtures/collections.yml | 12 ++
services/api/test/fixtures/links.yml | 15 --
.../arvados/v1/groups_controller_test.rb | 171 ++++++++-------------
5 files changed, 79 insertions(+), 127 deletions(-)
via 7d81fa519e768fd3bbafebef1530b1dfc5d845bc (commit)
from d10a66b66edc088d33bad52aebd7cac0a6e9ce49 (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 7d81fa519e768fd3bbafebef1530b1dfc5d845bc
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Aug 15 22:37:59 2014 -0400
3036: Remove include_linked from project contents method because 'name' links
are obsolete. Remove tests related to include_linked. Fix docker image lookups.
diff --git a/sdk/python/arvados/commands/keepdocker.py b/sdk/python/arvados/commands/keepdocker.py
index 236d9fc..c6bfc86 100644
--- a/sdk/python/arvados/commands/keepdocker.py
+++ b/sdk/python/arvados/commands/keepdocker.py
@@ -203,7 +203,6 @@ def main(arguments=None):
make_link('docker_image_hash', image_hash, **link_base)
if not image_hash.startswith(args.image.lower()):
- make_link('docker_image_repository', args.image, **link_base)
make_link('docker_image_repo+tag', '{}:{}'.format(args.image, args.tag),
**link_base)
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index f7d9fe8..458aefd 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -161,10 +161,10 @@ class Collection < ArvadosModel
# that looks like a Docker image, return it.
if loc = Locator.parse(search_term)
loc.strip_hints!
- coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).first
+ coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).limit(1).first
if coll_match and (coll_match.files.size == 1) and
(coll_match.files[0][1] =~ /^[0-9A-Fa-f]{64}\.tar$/)
- return [find_by_portable_data_hash(loc.to_s).uuid]
+ return [loc.to_s]
end
end
@@ -185,7 +185,8 @@ class Collection < ArvadosModel
# anything without; then we use the link's created_at as a tiebreaker.
uuid_timestamps = {}
matches.find_each do |link|
- uuid_timestamps[link.head_uuid] =
+ c = Collection.find_by_uuid(link.head_uuid)
+ uuid_timestamps[c.portable_data_hash] =
[(-link.properties["image_timestamp"].to_datetime.to_i rescue 0),
-link.created_at.to_i]
end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 5296eb8..c8144c2 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -149,3 +149,15 @@ empty_collection_name_in_active_user_home_project:
modified_at: 2014-08-06 22:11:51.242150425 Z
manifest_text: ""
name: Empty collection
+
+baz_file_in_asubproject:
+ uuid: 4n8aq-4zz18-0mri2x4u7ftngez
+ portable_data_hash: ea10d51bcf88862dbcc36eb292017dfd+45
+ owner_uuid: zzzzz-j7d0g-axqo7eu9pwvna1x
+ created_at: 2014-02-03T17:22:54Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-02-03T17:22:54Z
+ updated_at: 2014-02-03T17:22:54Z
+ manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
+ name: baz_file
diff --git a/services/api/test/fixtures/links.yml b/services/api/test/fixtures/links.yml
index 86eef00..ea7527e 100644
--- a/services/api/test/fixtures/links.yml
+++ b/services/api/test/fixtures/links.yml
@@ -496,21 +496,6 @@ docker_image_collection_hash:
properties:
image_timestamp: "2014-06-10T14:30:00.184019565Z"
-docker_image_collection_repository:
- uuid: zzzzz-o0j2j-dockercollrepos
- owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
- created_at: 2014-06-11 14:30:00.184389725 Z
- modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
- modified_by_user_uuid: zzzzz-tpzed-000000000000000
- modified_at: 2014-06-11 14:30:00.184019565 Z
- updated_at: 2014-06-11 14:30:00.183829316 Z
- link_class: docker_image_repository
- name: arvados/apitestfixture
- tail_uuid: ~
- head_uuid: 4n8aq-4zz18-1v45jub259sjjgb
- properties:
- image_timestamp: "2014-06-10T14:30:00.184019565Z"
-
docker_image_collection_tag:
uuid: zzzzz-o0j2j-dockercolltagbb
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index 276037f..e8ce6fd 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -90,44 +90,35 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
check_project_contents_response
end
- [false, true].each do |include_linked|
- test "list objects across projects, include_linked=#{include_linked}" do
- authorize_with :project_viewer
- get :contents, {
- format: :json,
- include_linked: include_linked,
- filters: [['uuid', 'is_a', 'arvados#specimen']]
- }
- assert_response :success
- found_uuids = json_response['items'].collect { |i| i['uuid'] }
- [[:in_aproject, true],
- [:in_asubproject, true],
- [:owned_by_private_group, false]].each do |specimen_fixture, should_find|
- if should_find
- assert_includes found_uuids, specimens(specimen_fixture).uuid, "did not find specimen fixture '#{specimen_fixture}'"
- else
- refute_includes found_uuids, specimens(specimen_fixture).uuid, "found specimen fixture '#{specimen_fixture}'"
- end
+ test "list objects across projects" do
+ authorize_with :project_viewer
+ get :contents, {
+ format: :json,
+ filters: [['uuid', 'is_a', 'arvados#specimen']]
+ }
+ assert_response :success
+ found_uuids = json_response['items'].collect { |i| i['uuid'] }
+ [[:in_aproject, true],
+ [:in_asubproject, true],
+ [:owned_by_private_group, false]].each do |specimen_fixture, should_find|
+ if should_find
+ assert_includes found_uuids, specimens(specimen_fixture).uuid, "did not find specimen fixture '#{specimen_fixture}'"
+ else
+ refute_includes found_uuids, specimens(specimen_fixture).uuid, "found specimen fixture '#{specimen_fixture}'"
end
end
end
- [false, true].each do |include_linked|
- test "list objects in home project, include_linked=#{include_linked}" do
- authorize_with :active
- get :contents, {
- format: :json,
- id: users(:active).uuid,
- include_linked: include_linked,
- }
- assert_response :success
- found_uuids = json_response['items'].collect { |i| i['uuid'] }
- if include_linked
- assert_includes found_uuids, collections(:empty).uuid, "empty collection did not appear in home project"
- end
- assert_includes found_uuids, specimens(:owned_by_active_user).uuid, "specimen did not appear in home project"
- refute_includes found_uuids, specimens(:in_asubproject).uuid, "specimen appeared unexpectedly in home project"
- end
+ test "list objects in home project" do
+ authorize_with :active
+ get :contents, {
+ format: :json,
+ id: users(:active).uuid
+ }
+ assert_response :success
+ found_uuids = json_response['items'].collect { |i| i['uuid'] }
+ assert_includes found_uuids, specimens(:owned_by_active_user).uuid, "specimen did not appear in home project"
+ refute_includes found_uuids, specimens(:in_asubproject).uuid, "specimen appeared unexpectedly in home project"
end
test "user with project read permission can see project collections" do
@@ -135,10 +126,9 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
get :contents, {
id: groups(:asubproject).uuid,
format: :json,
- include_linked: true,
}
ids = json_response['items'].map { |item| item["uuid"] }
- assert_includes ids, collections(:baz_file).uuid
+ assert_includes ids, collections(:baz_file_in_asubproject).uuid
end
test 'list objects across multiple projects' do
@@ -188,8 +178,8 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
authorize_with :project_viewer
@controller = Arvados::V1::LinksController.new
post :update, {
- id: links(:job_name_in_aproject).uuid,
- link: {name: "Denied test name"},
+ id: jobs(:running).uuid,
+ name: "Denied test name",
}
assert_includes(403..404, response.status)
end
@@ -198,7 +188,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
@controller = Arvados::V1::PipelineTemplatesController.new
authorize_with :project_viewer
post :update, {
- id: links(:template_name_in_aproject).head_uuid,
+ id: pipeline_templates(:two_part).uuid,
pipeline_template: {
owner_uuid: users(:project_viewer).uuid,
}
@@ -261,77 +251,42 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
assert_equal nil, uuids.index(unexpected_uuid)
end
- test 'get group-owned objects with include_linked' do
- expected_uuid = specimens(:in_asubproject).uuid
- authorize_with :active
- get :contents, {
- id: groups(:asubproject).uuid,
- include_linked: true,
- format: :json,
- }
- assert_response :success
- uuids = json_response['items'].collect { |i| i['uuid'] }
- assert_includes uuids, expected_uuid, "Did not get #{expected_uuid}"
- expected_name = specimens(:in_asubproject).name
- found_specimen_name = false
- assert(json_response['links'].any?,
- "Expected a non-empty array of links in response")
- json_response['links'].each do |link|
- if link['head_uuid'] == expected_uuid
- if link['name'] == expected_name
- found_specimen_name = true
- end
- end
- end
- assert(found_specimen_name,
- "Expected to find name '#{expected_name}' in response")
- end
-
- [false, true].each do |inc_ind|
- test "get all pages of group-owned #{'and -linked ' if inc_ind}objects" do
- authorize_with :active
- limit = 5
- offset = 0
- items_available = nil
- uuid_received = {}
- owner_received = {}
- while true
- # Behaving badly here, using the same controller multiple
- # times within a test.
- @json_response = nil
- get :contents, {
- id: groups(:aproject).uuid,
- include_linked: inc_ind,
- limit: limit,
- offset: offset,
- format: :json,
- }
- assert_response :success
- assert_operator(0, :<, json_response['items'].count,
- "items_available=#{items_available} but received 0 "\
- "items with offset=#{offset}")
- items_available ||= json_response['items_available']
- assert_equal(items_available, json_response['items_available'],
- "items_available changed between page #{offset/limit} "\
- "and page #{1+offset/limit}")
- json_response['items'].each do |item|
- uuid = item['uuid']
- assert_equal(nil, uuid_received[uuid],
- "Received '#{uuid}' again on page #{1+offset/limit}")
- uuid_received[uuid] = true
- owner_received[item['owner_uuid']] = true
- offset += 1
- if not inc_ind
- assert_equal groups(:aproject).uuid, item['owner_uuid']
- end
- end
- break if offset >= items_available
- end
- if inc_ind
- assert_operator 0, :<, (json_response.keys - [users(:active).uuid]).count,
- "Set include_linked=true but did not receive any non-owned items"
+ test "get all pages of group-owned objects" do
+ authorize_with :active
+ limit = 5
+ offset = 0
+ items_available = nil
+ uuid_received = {}
+ owner_received = {}
+ while true
+ # Behaving badly here, using the same controller multiple
+ # times within a test.
+ @json_response = nil
+ get :contents, {
+ id: groups(:aproject).uuid,
+ limit: limit,
+ offset: offset,
+ format: :json,
+ }
+ assert_response :success
+ assert_operator(0, :<, json_response['items'].count,
+ "items_available=#{items_available} but received 0 "\
+ "items with offset=#{offset}")
+ items_available ||= json_response['items_available']
+ assert_equal(items_available, json_response['items_available'],
+ "items_available changed between page #{offset/limit} "\
+ "and page #{1+offset/limit}")
+ json_response['items'].each do |item|
+ uuid = item['uuid']
+ assert_equal(nil, uuid_received[uuid],
+ "Received '#{uuid}' again on page #{1+offset/limit}")
+ uuid_received[uuid] = true
+ owner_received[item['owner_uuid']] = true
+ offset += 1
+ assert_equal groups(:aproject).uuid, item['owner_uuid']
end
+ break if offset >= items_available
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list