katello
katello copied to clipboard
Fixes #35363 - Wait for content_action_finish_timeout or the task-result
What are the changes introduced in this pull request?
Task is not waiting for the actual task result to finish. If the task was accepted by the agent and no error reported at the end of content_action_accept_timeout, task was indicated as success. This is not what should happen. With this change, we'll wait for the task result or for the content_action_finish_timeout to be reached.
Considerations taken when implementing this change?
What are the testing steps for this pull request?
Run tasks that will take more than content_action_accept_timeout to finish and ensure they are still being monitored.
Issues: #35363
ok to test
[test katello]
[test katello]
[test katello]
I can't seem to reproduce this. I get this error that's expected with/without the suspend on content_action_finish_timeout. "Host did not finish content action in 1 seconds. The task has been cancelled."
Example task that failed with the timeout error:
The failing test will pass with this change in the katello/test/actions/katello/agent_action_tests.rb test file. Let me know if the test makes sense.
def test_process_timeout_finish_not_elapsed
dispatch_history.accepted_at = Time.now
dispatch_history.result = nil
bulk_action_run = run_action(bulk_action)
travel_to 1.minute.from_now do
assert_equal bulk_action_run.phase, Dynflow::Action::Run
end
travel_to 2.hours.from_now do
error = assert_raises(StandardError) { bulk_action_run.process_timeout }
assert_match(/Host did not respond within/, error.message)
end
end
Closing in favor of https://github.com/Katello/katello/pull/10278 with cherry-picked commit from here and a test fix.