Skip to content

Commit

Permalink
Refs #36693 - use .end_of_day.utc for dates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Aug 29, 2023
1 parent e0c8f6e commit a934cc9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
46 changes: 25 additions & 21 deletions app/models/katello/rhel_lifecycle_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,47 @@ class RhelLifecycleStatus < HostStatus::Status
APPROACHING_END_OF_SUPPORT = 4
SUPPORT_ENDED = 5

def self.end_of_day(date)
DateTime.parse(date.to_s).end_of_day.utc
end

RHEL_EOS_SCHEDULE_INDEXES = { # dates that each support category ends
'RHEL9' => {
'full_support' => Date.parse('2027-05-31'),
'maintenance_support' => Date.parse('2032-05-31'),
'extended_support' => Date.parse('2035-05-31')
'full_support' => end_of_day('2027-05-31'),
'maintenance_support' => end_of_day('2032-05-31'),
'extended_support' => end_of_day('2035-05-31')
},
'RHEL8' => {
'full_support' => Date.parse('2024-05-31'),
'maintenance_support' => Date.parse('2029-05-31'),
'extended_support' => Date.parse('2032-05-31')
'full_support' => end_of_day('2024-05-31'),
'maintenance_support' => end_of_day('2029-05-31'),
'extended_support' => end_of_day('2032-05-31')
},
'RHEL7' => {
'full_support' => Date.parse('2019-08-06'),
'maintenance_support' => Date.parse('2024-06-30'),
'extended_support' => Date.parse('2028-06-30')
'full_support' => end_of_day('2019-08-06'),
'maintenance_support' => end_of_day('2024-06-30'),
'extended_support' => end_of_day('2028-06-30')
},
'RHEL7 (System z (Structure A))' => {
'full_support' => Date.parse('2019-08-06'),
'maintenance_support' => Date.parse('2021-05-31')
'full_support' => end_of_day('2019-08-06'),
'maintenance_support' => end_of_day('2021-05-31')
},
'RHEL7 (ARM)' => {
'full_support' => Date.parse('2019-08-06'),
'maintenance_support' => Date.parse('2020-11-30')
'full_support' => end_of_day('2019-08-06'),
'maintenance_support' => end_of_day('2020-11-30')
},
'RHEL7 (POWER9)' => {
'full_support' => Date.parse('2019-08-06'),
'maintenance_support' => Date.parse('2021-05-31')
'full_support' => end_of_day('2019-08-06'),
'maintenance_support' => end_of_day('2021-05-31')
},
'RHEL6' => {
'full_support' => Date.parse('2016-05-10'),
'maintenance_support' => Date.parse('2020-11-30'),
'extended_support' => Date.parse('2024-06-30')
'full_support' => end_of_day('2016-05-10'),
'maintenance_support' => end_of_day('2020-11-30'),
'extended_support' => end_of_day('2024-06-30')
},
'RHEL5' => {
'full_support' => Date.parse('2013-01-08'),
'maintenance_support' => Date.parse('2017-03-31'),
'extended_support' => Date.parse('2020-11-30')
'full_support' => end_of_day('2013-01-08'),
'maintenance_support' => end_of_day('2017-03-31'),
'extended_support' => end_of_day('2020-11-30')
}
}.freeze

Expand Down
4 changes: 2 additions & 2 deletions test/models/rhel_lifecycle_status_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def test_eos_schedule_constants
eos_schedule_data.each do |_, schedule|
assert schedule.is_a?(Hash)
%w[full_support maintenance_support].each { |support_category| assert schedule.key?(support_category) }
schedule.each do |support_category, date|
assert date.is_a?(Date)
schedule.each do |support_category, end_time|
assert end_time.is_a?(Time)
assert_includes %w[full_support maintenance_support extended_support], support_category
end
end
Expand Down

0 comments on commit a934cc9

Please sign in to comment.