Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

23.0.2 - Cherry-picks for content-mismatch with 23.0.1 #631

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/discovered_hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def perform_update(host, success_message = nil)
::ForemanDiscovery::HostConverter.set_build_clean_facts(host)
::ForemanDiscovery::HostConverter.unused_ip_for_host(host)
if host.save
success_options = { :success_redirect => host_path(host), :redirect_xhr => request.xhr? }
host_path = Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
success_options = { :success_redirect => host_path, :redirect_xhr => request.xhr? }
success_options[:success_msg] = success_message if success_message
process_success success_options
else
Expand Down
3 changes: 2 additions & 1 deletion lib/discovery.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ end

load 'tasks/jenkins.rake'
if Rake::Task.task_defined?(:'jenkins:unit')
Rake::Task["jenkins:unit"].enhance do
# The "unit" tests also include system tests
Rake::Task["jenkins:unit"].enhance(['webpack:compile']) do
Rake::Task['test:discovery'].invoke
end
end
2 changes: 1 addition & 1 deletion test/functional/discovered_hosts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_edit_form_quick_submit

managed_host = Host.find(host.id)
assert managed_host.build
assert_redirected_to host_url(managed_host)
assert_redirected_to host_details_page_path(managed_host)
assert_equal hostgroup.id, managed_host.hostgroup_id
assert_match(/Successfully/, flash[:success])
end
Expand Down
6 changes: 0 additions & 6 deletions test/functional/discovery_rules_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
class DiscoveryRulesControllerTest < ActionController::TestCase
setup :initialize_host

test "should add a link to navigation" do
get :index, params: {}, session: set_session_user
assert_response :success
assert response.body =~ /\/discovery_rules/
end

test "reader role should get index" do
get :index, params: {}, session: set_session_user_default_reader
assert_response :success
Expand Down
8 changes: 8 additions & 0 deletions test/integration/menu_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'test_helper'

class ManagedExtensionsTest < ActiveSupport::TestCase
def test_discovery_rules_is_in_menu
menu = UserMenu.new.generate
assert_includes(menu, { name: 'Discovery Rules', url: '/discovery_rules' })
end
end
3 changes: 2 additions & 1 deletion test/unit/host_discovered_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ class HostDiscoveredTest < ActiveSupport::TestCase
@facts["productname"] = "Dishwasher DW400"
host2 = discover_host_from_facts(@facts)
assert_equal 'mace41f13cc3658', host2.name
assert_equal 'Dishwasher DW400', host2.facts["productname"]
# Bypass fact cache by using it as a method
assert_equal 'Dishwasher DW400', host2.facts('productname')['productname']
assert_equal '10.35.27.2', host2.ip
assert_equal 1, Host::Discovered.where(:name => 'mace41f13cc3658').count
end
Expand Down
Loading