Actions
Bug #18157
closedActions::Foreman::Report::Import.cleanup_after parses ActiveSupport::Duration#parts incorrectly
Description
Under Rails 5.0.1, the Actions::Foreman::Report::Import.cleanup_after
method fails to return the correct number of days and fails the existing unit test:
cleanup#test_0001_derive the number of dates based on Report::DEFAULT_EXPIRATION [test/unit/actions/report/import_test.rb:39]:
Expected: "7d"
Actual: "d"
The code attempts to do Hash[1.week.parts][:days]
, but the ActiveSupport::Duration#parts method isn't a very reliable API to determine days from a duration, as it depends on how the duration was constructed. Under Rails 4.2.7.1 it returns [[:days, 7]]
but under Rails 5.0.1 it returns [[:weeks, 1]]
.
It should use division of durations or .to_i to be more reliable.
Updated by The Foreman Bot almost 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/4209 added
Updated by Dominic Cleal almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 3a1cd1dbeb74c60a482d7c47fc290c185d7c707a.
Updated by Dominic Cleal almost 8 years ago
- Translation missing: en.field_release set to 209
Actions