Skip to content

Commit

Permalink
Make old foreman task 32 days older
Browse files Browse the repository at this point in the history
(cherry picked from commit bcc6141)
  • Loading branch information
lpramuk authored and web-flow committed Aug 29, 2023
1 parent 4eacd92 commit 40531ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/foreman/maintain/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,14 @@ def test_positive_health_check_old_foreman_tasks(sat_maintain):
:expectedresults: check-old-foreman-tasks health check should pass.
"""
rake_command = 'foreman-rake console <<< '
find_task = '\'t = ForemanTasks::Task.where(state: "stopped").first;'
update_task = "t.started_at = t.started_at - 31.day;t.save(:validate => false)'"
error_message = 'paused or stopped task(s) older than 30 days'
delete_message = 'Deleted old tasks:'
sat_maintain.execute(rake_command + find_task + update_task)
rake_command = (
't = ForemanTasks::Task.where(state: "stopped").first;'
't.started_at = t.started_at - 32.day;'
't.save(:validate => false)'
)
sat_maintain.execute(f"foreman-rake console <<< '{rake_command}'")
result = sat_maintain.cli.Health.check(
options={'label': 'check-old-foreman-tasks', 'assumeyes': True}
)
Expand Down

0 comments on commit 40531ce

Please sign in to comment.