Project

General

Profile

Bug #25546

silent errors in Katello::Host::HypervisorsUpdateTest

Added by Evgeni Golov 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

While working on #25415, I've noticed that HypervisorsUpdateTest silently accepts failed actions.

Example:

[2018-11-26 09:43:41.835 #5668] ERROR --  action: Setting 'default_location_subscribed_hosts' is not set to a valid location. (RuntimeError)
katello/katello/app/models/katello/concerns/location_extensions.rb:78:in `default_host_subscribe_location!'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:99:in `create_host_for_hypervisor'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:63:in `block in create_missing_hosts'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:60:in `each'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:60:in `create_missing_hosts'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:35:in `load_resources'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:20:in `block in finalize'
theforeman/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as'
theforeman/foreman/app/models/concerns/foreman/thread_session.rb:106:in `as_anonymous_admin'
katello/katello/app/lib/actions/katello/host/hypervisors_update.rb:19:in `finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:560:in `block (2 levels) in execute_finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:26:in `pass'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware.rb:18:in `pass'
katello/katello/app/lib/actions/middleware/remote_action.rb:20:in `block in finalize'
katello/katello/app/lib/actions/middleware/remote_action.rb:40:in `block in as_remote_user'
katello/katello/app/models/katello/concerns/user_extensions.rb:21:in `cp_config'
katello/katello/app/lib/actions/middleware/remote_action.rb:27:in `as_cp_user'
katello/katello/app/lib/actions/middleware/remote_action.rb:39:in `as_remote_user'
katello/katello/app/lib/actions/middleware/remote_action.rb:20:in `finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:22:in `call'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:26:in `pass'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware.rb:18:in `pass'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/foreman-tasks-0.14.3/app/lib/actions/middleware/rails_executor_wrap.rb:20:in `block in finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/execution_wrapper.rb:87:in `wrap'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/foreman-tasks-0.14.3/app/lib/actions/middleware/rails_executor_wrap.rb:19:in `finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:22:in `call'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:26:in `pass'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware.rb:18:in `pass'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action/progress.rb:30:in `with_progress_calculation'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action/progress.rb:22:in `finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/stack.rb:22:in `call'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/middleware/world.rb:30:in `execute'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:559:in `block in execute_finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:451:in `block in with_error_handling'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:451:in `catch'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:451:in `with_error_handling'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:558:in `execute_finalize'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/action.rb:278:in `execute'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/dynflow-1.1.2/lib/dynflow/testing/factories.rb:94:in `finalize_action'
katello/katello/test/actions/katello/host/hypervisors_update_test.rb:68:in `block (3 levels) in <class:HypervisorsUpdateTest>'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/testing/assertions.rb:98:in `assert_difference'
katello/katello/test/actions/katello/host/hypervisors_update_test.rb:67:in `block (2 levels) in <class:HypervisorsUpdateTest>'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:107:in `block (3 levels) in run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:204:in `capture_exceptions'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:104:in `block (2 levels) in run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:255:in `time_it'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:103:in `block in run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:350:in `on_signal'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:275:in `with_info_handler'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest/test.rb:102:in `run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:839:in `run_one_method'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:324:in `run_one_method'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:311:in `block (2 levels) in run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:310:in `each'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:310:in `block in run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:350:in `on_signal'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:337:in `with_info_handler'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:309:in `run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/test_unit/line_filtering.rb:10:in `run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:159:in `block in __run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:159:in `map'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:159:in `__run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:136:in `run'
theforeman/foreman/vendor/bundle/ruby/2.5.0/gems/minitest-5.10.3/lib/minitest.rb:63:in `block in autorun'

However, the tests don't catch this, as they don't assert that the action has been actually successful.

Associated revisions

Revision 3fa2ee88 (diff)
Added by Evgeni Golov 7 months ago

Fixes #25546 - assert action state in HypervisorsUpdateTest (#7850)

This PR from Evgeni Golov changes two things:

  • makes load_hosts_by_uuid actually work
  • makes load_hosts_by_uuid verify the org of the host

History

#1 Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7850 added

#2 Updated by Evgeni Golov 7 months ago

  • Status changed from Ready For Testing to New

#3 Updated by Evgeni Golov 7 months ago

The attached PR exposes the issue by checking action.state and results in:

Failure:
Katello::Host::HypervisorsUpdateTest::Hypervisors Update#test_0003_existing hypervisor, renamed [katello/katello/test/actions/katello/host/hypervisors_update_test.rb:76]:
Expected: :success
  Actual: :error

#4 Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing

#5 Updated by Evgeni Golov 7 months ago

  • Assignee set to Evgeni Golov

#6 Updated by Christine Fouant 7 months ago

  • Triaged changed from No to Yes
  • Target version set to Katello 3.10.0

#7 Updated by Christine Fouant 7 months ago

  • Target version changed from Katello 3.10.0 to Katello 3.11.0

#8 Updated by Evgeni Golov 7 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF