Skip to content

Commit

Permalink
Fix ssh_to_compute_node? to not error on non-existant cluster (#1274)
Browse files Browse the repository at this point in the history
Fixes #1273
  • Loading branch information
treydock authored Jul 1, 2021
1 parent c48a68a commit e866ff2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/dashboard/app/models/batch_connect/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ def ssh_to_compute_node?
# @return [Boolean]
def cluster_ssh_to_compute_node?
cluster.batch_connect_ssh_allow?
rescue ClusterNotFound
return nil
end

# @return [Boolean]
Expand Down
7 changes: 7 additions & 0 deletions apps/dashboard/test/models/batch_connect/session_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,11 @@ def completed?
Configuration.stubs(:ood_bc_ssh_to_compute_node).returns(false)
assert session.ssh_to_compute_node?
end

test "ssh_to_compute_node? handles non-existant cluster and disabled globally" do
session = BatchConnect::Session.new
session.stubs(:cluster).raises(BatchConnect::Session::ClusterNotFound, "Session specifies nonexistent")
Configuration.stubs(:ood_bc_ssh_to_compute_node).returns(false)
refute session.ssh_to_compute_node?
end
end

0 comments on commit e866ff2

Please sign in to comment.