[arvados] updated: 2.7.0-6260-g1cbe53acb6

git repository hosting git at public.arvados.org
Mon Mar 25 22:43:58 UTC 2024


Summary of changes:
 .../test/integration/discovery_document_test.rb    | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

       via  1cbe53acb64995975bf5d951fd484451846dddc0 (commit)
      from  342d41c1745b40ef78739fe9599be11f6dc529c5 (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 1cbe53acb64995975bf5d951fd484451846dddc0
Author: Tom Clegg <tom at curii.com>
Date:   Mon Mar 25 18:42:49 2024 -0400

    21617: Test unauthenticated endpoint with LoginCluster in use.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/api/test/integration/discovery_document_test.rb b/services/api/test/integration/discovery_document_test.rb
index 37e7750297..9df3f6bc8b 100644
--- a/services/api/test/integration/discovery_document_test.rb
+++ b/services/api/test/integration/discovery_document_test.rb
@@ -55,4 +55,40 @@ class DiscoveryDocumentTest < ActionDispatch::IntegrationTest
                    "Commit that to #{src_path} to regenerate documentation",
                  ].join(". "))
   end
+
+  [
+    ["valid token", :active],
+    ["expired token", :expired],
+    ["no token", {}],
+    ["bogus token", {'HTTP_AUTHORIZATION' => "Bearer xxx"}],
+    ["badly formed Authorization header", {'HTTP_AUTHORIZATION' => "xxx"}],
+  ].each do |label, headers|
+    test "configured with LoginCluster, get discovery doc with #{label}" do
+      # Stub login cluster with a server that always returns HTTP 401
+      require 'webrick'
+      require 'webrick/https'
+      stub_server = WEBrick::HTTPServer.new(Port: 0, Host: "0.0.0.0", SSLEnable: true, SSLCertName: [['CN', '0.0.0.0']])
+      stub_server.mount_proc '/' do |req, res|
+        res.status = 401
+      end
+      Rails.configuration.Login.LoginCluster = 'zbbbb'
+      Rails.configuration.RemoteClusters['zbbbb'] = ActiveSupport::OrderedOptions.new
+      Rails.configuration.RemoteClusters['zbbbb']['Host'] = "0.0.0.0:#{stub_server.listeners[0].addr()[1]}"
+      Rails.configuration.RemoteClusters['zbbbb']['Insecure'] = true
+      Thread.new do
+        stub_server.start
+      end
+
+      begin
+        if headers.is_a? Symbol
+          headers = auth(headers)
+        end
+        get "/discovery/v1/apis/arvados/v1/rest", headers: headers
+        assert_response :success
+      ensure
+        stub_server.shutdown
+      end
+    end
+  end
+
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list