[ARVADOS] updated: 040f1c94dfa1a53356d24e77afdbc0f2e5cfe91c
git at public.curoverse.com
git at public.curoverse.com
Tue May 20 14:11:18 EDT 2014
Summary of changes:
.../arvados/v1/keep_services_controller.rb | 6 ++++++
services/api/test/fixtures/keep_services.yml | 10 ++++++++-
services/api/test/integration/keep_proxy_test.rb | 25 ++++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 services/api/test/integration/keep_proxy_test.rb
via 040f1c94dfa1a53356d24e77afdbc0f2e5cfe91c (commit)
from ab710b74b2751f9a0d4eb5c5f950c6bb04865e79 (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 040f1c94dfa1a53356d24e77afdbc0f2e5cfe91c
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 20 14:11:15 2014 -0400
2776: Added test for keep_services/accessable route.
diff --git a/services/api/app/controllers/arvados/v1/keep_services_controller.rb b/services/api/app/controllers/arvados/v1/keep_services_controller.rb
index 43ce94d..8c7ae7a 100644
--- a/services/api/app/controllers/arvados/v1/keep_services_controller.rb
+++ b/services/api/app/controllers/arvados/v1/keep_services_controller.rb
@@ -1,5 +1,8 @@
class Arvados::V1::KeepServicesController < ApplicationController
+ skip_before_filter :find_object_by_uuid, only: :accessable
+ skip_before_filter :render_404_if_no_object, only: :accessable
+
def find_objects_for_index
# all users can list all keep services
@objects = model_class.where('1=1')
@@ -7,12 +10,15 @@ class Arvados::V1::KeepServicesController < ApplicationController
end
def accessable
+ puts "Hello world"
if request.headers['X-Keep-Proxy-Required']
@objects = model_class.where('service_type=?', 'proxy')
else
@objects = model_class.where('service_type=?', 'disk')
end
+ puts "Rendering list now"
+
render_list
end
diff --git a/services/api/test/fixtures/keep_services.yml b/services/api/test/fixtures/keep_services.yml
index d3b1b2a..84ac316 100644
--- a/services/api/test/fixtures/keep_services.yml
+++ b/services/api/test/fixtures/keep_services.yml
@@ -12,4 +12,12 @@ keep1:
service_host: keep1.qr1hi.arvadosapi.com
service_port: 25107
service_ssl_flag: false
- service_type: disk
\ No newline at end of file
+ service_type: disk
+
+proxy:
+ uuid: zzzzz-bi6l4-h0a0xwut9qa6g3a
+ owner_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ service_host: keep.qr1hi.arvadosapi.com
+ service_port: 25333
+ service_ssl_flag: true
+ service_type: proxy
diff --git a/services/api/test/integration/keep_proxy_test.rb b/services/api/test/integration/keep_proxy_test.rb
new file mode 100644
index 0000000..130b252
--- /dev/null
+++ b/services/api/test/integration/keep_proxy_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class KeepProxyTest < ActionDispatch::IntegrationTest
+ test "request keep disks" do
+ get "/arvados/v1/keep_services/accessable", {:format => :json}, auth(:active)
+ assert_response :success
+ services = json_response['items']
+
+ assert_equal 2, services.length
+ assert_equal 'disk', services[0]['service_type']
+ assert_equal 'disk', services[1]['service_type']
+
+ get "/arvados/v1/keep_services/accessable", {:format => :json}, auth(:active).merge({'HTTP_X_KEEP_PROXY_REQUIRED' => true})
+ assert_response :success
+ services = json_response['items']
+
+ assert_equal 1, services.length
+
+ assert_equal "zzzzz-bi6l4-h0a0xwut9qa6g3a", services[0]['uuid']
+ assert_equal "keep.qr1hi.arvadosapi.com", services[0]['service_host']
+ assert_equal 25333, services[0]['service_port']
+ assert_equal true, services[0]['service_ssl_flag']
+ assert_equal 'proxy', services[0]['service_type']
+ end
+end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list