11906: add _health/.* to errors_test routes
authorradhika <radhika@curoverse.com>
Tue, 18 Jul 2017 17:30:53 +0000 (13:30 -0400)
committerradhika <radhika@curoverse.com>
Tue, 18 Jul 2017 17:30:53 +0000 (13:30 -0400)
Arvados-DCO-1.1-Signed-off-by: Radhika Chippada <radhika@curoverse.com>

services/api/app/controllers/arvados/v1/healthcheck_controller.rb
services/api/test/integration/errors_test.rb

index 41f7175f926f56106c42b105b694e5585a2c48d6..47b49ff46adff90ae20b3b8831e7d2339aa73819 100644 (file)
@@ -17,16 +17,14 @@ class Arvados::V1::HealthcheckController < ApplicationController
 
   def check_auth_header
     mgmt_token = Rails.configuration.management_token
+    auth_header = request.headers['Authorization']
 
     if !mgmt_token
       send_error("disabled", status: 404)
-    else
-      auth_header = request.headers['Authorization']
-      if !auth_header
-        send_error("authorization required", status: 401)
-      elsif auth_header != 'Bearer '+mgmt_token
-        send_error("authorization error", status: 403)
-      end
+    elsif !auth_header
+      send_error("authorization required", status: 401)
+    elsif auth_header != 'Bearer '+mgmt_token
+      send_error("authorization error", status: 403)
     end
   end
 
index 2ef85bc0af548a18019bd4caf49d2b9c252a93c1..142455880d5d2fbfc7247ab6113bac20e1d95897 100644 (file)
@@ -23,7 +23,7 @@ class ErrorsTest < ActionDispatch::IntegrationTest
       # Generally, new routes should appear under /arvados/v1/. If
       # they appear elsewhere, that might have been caused by default
       # rails generator behavior that we don't want.
-      assert_match(/^\/(|\*a|arvados\/v1\/.*|auth\/.*|login|logout|database\/reset|discovery\/.*|static\/.*|themes\/.*|assets)(\(\.:format\))?$/,
+      assert_match(/^\/(|\*a|arvados\/v1\/.*|auth\/.*|login|logout|database\/reset|discovery\/.*|static\/.*|themes\/.*|assets|_health\/.*)(\(\.:format\))?$/,
                    route.path.spec.to_s,
                    "Unexpected new route: #{route.path.spec}")
     end