Skip to content

Commit

Permalink
Fixes #34166 - opt in the new host page by default
Browse files Browse the repository at this point in the history
  • Loading branch information
amirfefer authored and ezr-ondrej committed Jan 6, 2022
1 parent 951efe8 commit 98c1752
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/registries/foreman/settings/general.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
setting('host_details_ui',
type: :boolean,
description: N_("Foreman will load the new UI for host details"),
default: false,
default: true,
full_name: N_('New host details UI'))
end
end
10 changes: 5 additions & 5 deletions test/controllers/hosts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def host_attributes(host)
test 'create_valid' do
Host.any_instance.stubs(:valid?).returns(true)
post :create, params: { :host => {:name => "test"} }, session: set_session_user
assert_redirected_to host_url(assigns('host'))
assert_redirected_to host_details_page_url(assigns('host'))
end

test "should get index" do
Expand Down Expand Up @@ -101,7 +101,7 @@ def host_attributes(host)
},
}, session: set_session_user
end
assert_redirected_to host_url(assigns['host'])
assert_redirected_to host_details_page_url(assigns['host'])
end

context "with libvirt" do
Expand Down Expand Up @@ -186,7 +186,7 @@ def teardown
assert new_host.puppet_proxy.present?
assert_equal hostgroup.puppet_proxy, new_host.puppet_proxy
end
assert_redirected_to host_url(assigns['host'])
assert_redirected_to host_details_page_url(assigns['host'])
end

test "should get edit" do
Expand All @@ -210,7 +210,7 @@ def test_update_invalid
def test_update_valid
Host.any_instance.stubs(:valid?).returns(true)
put :update, params: { :id => Host.first.name, :host => {:name => "Updated_#{Host.first.name}"} }, session: set_session_user
assert_redirected_to host_url(assigns(:host))
assert_redirected_to host_details_page_url(assigns(:host))
end

test "should destroy host" do
Expand Down Expand Up @@ -1432,7 +1432,7 @@ class Host::Test < Host::Base; end
host: { compute_attributes: { scsi_controllers: { 'scsiControllers' => scsi_controllers, 'volumes' => [volume_params] }.to_json } },
}, session: set_session_user

assert_redirected_to host_path(@vmware_host.to_param)
assert_redirected_to host_details_page_path(@vmware_host.to_param)
end
end
end
Expand Down
21 changes: 13 additions & 8 deletions test/integration/host_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class HostJSTest < IntegrationTestWithJavascript
end

test "has proper title and links" do
visit hosts_path
click_link @host.fqdn
assert_breadcrumb_text(@host.fqdn)
visit host_path @host
assert page.has_link?("Properties", :href => "#properties")
assert page.has_link?("Metrics", :href => "#metrics")
assert page.has_link?("Templates", :href => "#template")
Expand Down Expand Up @@ -76,6 +74,12 @@ class HostJSTest < IntegrationTestWithJavascript
Setting[:host_details_ui] = false
end

test "assert breadcrumbs" do
visit hosts_path
click_link @host.fqdn
find('.pf-c-breadcrumb__item', :text => @host.fqdn)
end

test "new show page" do
visit hosts_path
click_link @host.fqdn
Expand All @@ -95,7 +99,7 @@ class HostJSTest < IntegrationTestWithJavascript
assert_equal '', page.find('#host_name').value
end

test "delete host" do
test "delete host redirects to hosts index" do
host = FactoryBot.create(:host)
visit host_details_page_path(host)
find('#hostdetails-kebab').click
Expand Down Expand Up @@ -302,8 +306,8 @@ class HostJSTest < IntegrationTestWithJavascript
select2 domains(:mydomain).name, :from => 'host_interfaces_attributes_0_domain_id'
fill_in 'host_interfaces_attributes_0_ip', :with => '1.1.1.1'
close_interfaces_modal
click_on_submit
find('#host-show') # wait for host details page
click_button('Submit')
find('h5', :text => /myhost1*/)

host = Host::Managed.search_for('name ~ "myhost1"').first
assert_equal compute_resource.name, host.compute_resource.name
Expand Down Expand Up @@ -341,7 +345,8 @@ class HostJSTest < IntegrationTestWithJavascript

close_interfaces_modal

click_on_submit
click_button('Submit')
find('h5', :text => /myhost1*/)

host = Host::Managed.search_for('name ~ "myhost1"').first
assert_equal hg.compute_resource.name, host.compute_resource.name
Expand Down Expand Up @@ -471,7 +476,7 @@ class HostJSTest < IntegrationTestWithJavascript
assert page.has_selector?(id)
page.find(id).click
assert page.has_no_selector?(id)
click_on_submit
click_button('Submit')

visit edit_host_path(host)
switch_form_tab('Parameters')
Expand Down
9 changes: 0 additions & 9 deletions test/integration/host_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ class HostIntegrationTest < ActionDispatch::IntegrationTest
end
end

test "destroy redirects to hosts index" do
disable_orchestration # Avoid DNS errors
visit hosts_path
click_link @host.fqdn
assert page.has_link?("Delete", :href => "/hosts/#{@host.fqdn}")
first(:link, "Delete").click
assert_current_path hosts_path
end

describe 'edit page' do
test 'displays warning when vm not found by uuid' do
ComputeResource.any_instance.stubs(:find_vm_by_uuid).raises(ActiveRecord::RecordNotFound)
Expand Down

0 comments on commit 98c1752

Please sign in to comment.