Actions
Bug #25546
closedsilent errors in Katello::Host::HypervisorsUpdateTest
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.
Actions