X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/30e420e6cc547a12f2a775188f0429b3607da6c3..66c13b6055a363cb08197b8c5d040ed9a511c8ca:/apps/workbench/test/functional/application_controller_test.rb diff --git a/apps/workbench/test/functional/application_controller_test.rb b/apps/workbench/test/functional/application_controller_test.rb index 50f990aa0b..c2828020bd 100644 --- a/apps/workbench/test/functional/application_controller_test.rb +++ b/apps/workbench/test/functional/application_controller_test.rb @@ -303,4 +303,22 @@ class ApplicationControllerTest < ActionController::TestCase get(:show, {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session_for(:admin)) assert_response 404 end + + test "Workbench returns 4xx when API server is unreachable" do + # We're really testing ApplicationController's render_exception. + # Our primary concern is that it doesn't raise an error and + # return 500. + orig_api_server = Rails.configuration.arvados_v1_base + begin + # The URL should look valid in all respects, and avoid talking over a + # network. 100::/64 is the IPv6 discard prefix, so it's perfect. + Rails.configuration.arvados_v1_base = "https://[100::f]:1/" + @controller = NodesController.new + get(:index, {}, session_for(:active)) + assert_includes(405..422, @response.code.to_i, + "bad response code when API server is unreachable") + ensure + Rails.configuration.arvados_v1_base = orig_api_server + end + end end