[ARVADOS] created: 1.3.0-1275-gae3c4f3be

Git user git at public.curoverse.com
Tue Jul 9 19:39:16 UTC 2019


        at  ae3c4f3be309076773673248e5381fb5828fd663 (commit)


commit ae3c4f3be309076773673248e5381fb5828fd663
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Jul 9 16:38:04 2019 -0300

    15318: Updates tests.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/test/functional/application_controller_test.rb b/services/api/test/functional/application_controller_test.rb
index d382c1c6a..b74ff0f41 100644
--- a/services/api/test/functional/application_controller_test.rb
+++ b/services/api/test/functional/application_controller_test.rb
@@ -25,13 +25,15 @@ class ApplicationControllerTest < ActionController::TestCase
     assert_operator(token_time, :>=, @start_stamp, "error token too old")
     assert_operator(token_time, :<=, now_timestamp, "error token too new")
     json_response['errors'].each do |err|
-      assert_match(/req-[a-z0-9]{20}/, err)
+      assert_match(/req-[a-z0-9]{20}/, err, "X-Request-Id value missing on error message")
     end
   end
 
   def check_404(errmsg="Path not found")
     assert_response 404
-    assert_includes(json_response['errors'].first, errmsg)
+    json_response['errors'].each do |err|
+      assert(err.include?(errmsg), "error message '#{err}' expected to include '#{errmsg}'")
+    end
     check_error_token
   end
 
diff --git a/services/api/test/integration/login_workflow_test.rb b/services/api/test/integration/login_workflow_test.rb
index 8691030e9..f0741fcfd 100644
--- a/services/api/test/integration/login_workflow_test.rb
+++ b/services/api/test/integration/login_workflow_test.rb
@@ -10,7 +10,9 @@ class LoginWorkflowTest < ActionDispatch::IntegrationTest
       params: {specimen: {}},
       headers: {'HTTP_ACCEPT' => ''})
     assert_response 401
-    assert_includes(json_response['errors'], "Not logged in")
+    json_response['errors'].each do |err|
+      assert(err.include?("Not logged in"), "error message '#{err}' expected to include 'Not logged in'")
+    end
   end
 
   test "login prompt respects JSON Accept header" do
@@ -18,7 +20,9 @@ class LoginWorkflowTest < ActionDispatch::IntegrationTest
       params: {specimen: {}},
       headers: {'HTTP_ACCEPT' => 'application/json'})
     assert_response 401
-    assert_includes(json_response['errors'], "Not logged in")
+    json_response['errors'].each do |err|
+      assert(err.include?("Not logged in"), "error message '#{err}' expected to include 'Not logged in'")
+    end
   end
 
   test "login prompt respects HTML Accept header" do

commit d77c5b5925be6182430da592dedeeaaf05558554
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Jul 9 16:15:32 2019 -0300

    15318: Adds X-Request-Id value to every error response. Fixes test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index e07a5aca7..d5bc3f35d 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -183,6 +183,9 @@ class ApplicationController < ActionController::Base
       err = {}
     end
     err[:errors] ||= args
+    err[:errors].map! do |err|
+      err += " (" + Thread.current[:request_id] + ")"
+    end
     err[:error_token] = [Time.now.utc.to_i, "%08x" % rand(16 ** 8)].join("+")
     status = err.delete(:status) || 422
     logger.error "Error #{err[:error_token]}: #{status}"
diff --git a/services/api/test/functional/application_controller_test.rb b/services/api/test/functional/application_controller_test.rb
index 4f112dbae..d382c1c6a 100644
--- a/services/api/test/functional/application_controller_test.rb
+++ b/services/api/test/functional/application_controller_test.rb
@@ -31,7 +31,7 @@ class ApplicationControllerTest < ActionController::TestCase
 
   def check_404(errmsg="Path not found")
     assert_response 404
-    assert_equal([errmsg], json_response['errors'])
+    assert_includes(json_response['errors'].first, errmsg)
     check_error_token
   end
 

commit 31d8469fa1adfa0c3a07a23725f26b26f2291df5
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Jul 9 16:09:53 2019 -0300

    15318: Updates test to expect X-Request-Id value on error messages.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/test/functional/application_controller_test.rb b/services/api/test/functional/application_controller_test.rb
index b5f71acb5..4f112dbae 100644
--- a/services/api/test/functional/application_controller_test.rb
+++ b/services/api/test/functional/application_controller_test.rb
@@ -24,6 +24,9 @@ class ApplicationControllerTest < ActionController::TestCase
     token_time = token.split('+', 2).first.to_i
     assert_operator(token_time, :>=, @start_stamp, "error token too old")
     assert_operator(token_time, :<=, now_timestamp, "error token too new")
+    json_response['errors'].each do |err|
+      assert_match(/req-[a-z0-9]{20}/, err)
+    end
   end
 
   def check_404(errmsg="Path not found")

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list