Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36853 - Fix the tests that caused SIGKILL #10774

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,54 +32,17 @@ def teardown
end

def test_with_year_2024_1_1
Time.stubs(:now).returns(Time.utc(2024, 1, 1))
expire_soon = {"RHEL7" => {"maintenance_support" => Time.parse("2024-06-30")}, "RHEL6" => {"extended_support" => Time.parse("2024-06-30")}}
::Katello::RhelLifecycleStatus.expects(:lifecycles_expire_soon).returns(expire_soon)
@subject.expects(:hosts_with_index).with("RHEL6").returns([mock('rhel6')])
@subject.expects(:hosts_with_index).with("RHEL7").returns([mock('rhel7')])
@subject.deliver!
assert_equal 2, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2025_1_1
Time.stubs(:now).returns(Time.utc(2025, 1, 1))
@subject.deliver!
assert_equal 0, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2026_6_1
Time.stubs(:now).returns(Time.utc(2026, 6, 1))
@subject.deliver!
assert_equal 0, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2027_7_1
Time.stubs(:now).returns(Time.utc(2027, 7, 1))
@subject.expects(:hosts_with_index).with("RHEL7").returns([mock('rhel7')])
@subject.deliver!
assert_equal 1, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2028_6_1
Time.stubs(:now).returns(Time.utc(2028, 6, 1))
@subject.expects(:hosts_with_index).with("RHEL7").returns([mock('rhel7')])
@subject.expects(:hosts_with_index).with("RHEL8").returns([mock('rhel8')])
@subject.deliver!
assert_equal 2, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2029_6_1
Time.stubs(:now).returns(Time.utc(2029, 6, 1))
@subject.deliver!
assert_equal 0, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2030_6_1
Time.stubs(:now).returns(Time.utc(2030, 6, 1))
@subject.deliver!
assert_equal 0, NotificationBlueprint.find_by(name: 'host_lifecycle_expire_soon').notifications.count
end

def test_with_year_2031_6_1
Time.stubs(:now).returns(Time.utc(2031, 6, 1))
expire_soon = {"RHEL9" => {"maintenance_support" => Time.parse("2032-05-31")}, "RHEL8" => {"extended_support" => Time.parse("2032-05-31")}}
::Katello::RhelLifecycleStatus.expects(:lifecycles_expire_soon).returns(expire_soon)
@subject.expects(:hosts_with_index).with("RHEL8").returns([mock('rhel8')])
@subject.expects(:hosts_with_index).with("RHEL9").returns([mock('rhel9')])
@subject.deliver!
Expand Down
Loading