katello icon indicating copy to clipboard operation
katello copied to clipboard

Fixes #35363 - Wait for content_action_finish_timeout or the task-result

Open jpasqualetto opened this issue 2 years ago • 2 comments

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.

jpasqualetto avatar Aug 13 '22 20:08 jpasqualetto

Issues: #35363

theforeman-bot avatar Aug 13 '22 20:08 theforeman-bot

ok to test

chris1984 avatar Aug 17 '22 17:08 chris1984

[test katello]

ianballou avatar Aug 31 '22 17:08 ianballou

[test katello]

sjha4 avatar Sep 07 '22 14:09 sjha4

[test katello]

sjha4 avatar Sep 07 '22 19:09 sjha4

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: Screenshot from 2022-09-08 12-41-04

sjha4 avatar Sep 08 '22 14:09 sjha4

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

sjha4 avatar Sep 08 '22 17:09 sjha4

Closing in favor of https://github.com/Katello/katello/pull/10278 with cherry-picked commit from here and a test fix.

sjha4 avatar Sep 19 '22 15:09 sjha4