11014: Check for PipelineIndex#index API to exist for rendering the compute node...
authorLucas Di Pentima <lucas@curoverse.com>
Thu, 16 Mar 2017 18:18:23 +0000 (15:18 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Thu, 16 Mar 2017 18:18:23 +0000 (15:18 -0300)
Added related test.

apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/test/controllers/disabled_api_test.rb

index ab6eb16f5153862061a40c6b59f85bd89819c4f5..4f01f9d357c6b519fe2e2d7f34eff4174dd2933f 100644 (file)
     </div>
 
     <div class="col-md-6">
+      <% if PipelineInstance.api_exists?(:index) %>
       <% nodes = Node.filter([["last_ping_at", ">", Time.now - 3600]]).results %>
       <div class="panel panel-default" style="min-height: 10.5em">
         <div class="panel-heading"><span class="panel-title">Compute node status</span>
           </div>
         </div>
       </div>
+      <% end %>
       <% if Rails.configuration.show_recent_collections_on_dashboard %>
       <div class="panel panel-default">
         <div class="panel-heading"><span class="panel-title">Recent collections</span>
index 47276c02e835419cf89601e78c153f4f5431df21..55c7b2409231a6bde640be7ca51f7c65805e0967 100644 (file)
@@ -15,6 +15,17 @@ class DisabledApiTest < ActionController::TestCase
     assert_includes @response.body, "Run a process"
   end
 
+  test "dashboard compute node status when pipeline_instance index API is disabled" do
+    @controller = ProjectsController.new
+
+    dd = ArvadosApiClient.new_or_current.discovery.deep_dup
+    dd[:resources][:pipeline_instances][:methods].delete(:index)
+    ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
+
+    get :index, {}, session_for(:active)
+    assert_not_includes @response.body, "compute-node-summary-pane"
+  end
+
   [
     [:jobs, JobsController.new],
     [:job_tasks, JobTasksController.new],