Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #30129 - Improve experience around expired and deleted manifests
- Loading branch information
Showing
34 changed files
with
319 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Katello | ||
class UpstreamConnectionChecker | ||
def initialize(organization) | ||
@organization = organization | ||
end | ||
|
||
def assert_connection | ||
assert_connected | ||
assert_unexpired_manifest | ||
assert_can_upstream_ping | ||
|
||
true | ||
end | ||
|
||
private | ||
|
||
def assert_connected | ||
fail Katello::Errors::DisconnectedMode if Setting[:content_disconnected] | ||
end | ||
|
||
def assert_can_upstream_ping | ||
Katello::Resources::Candlepin::UpstreamConsumer.ping | ||
end | ||
|
||
def assert_unexpired_manifest | ||
fail Katello::Errors::ManifestExpired if @organization.manifest_expired? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'katello_test_helper' | ||
|
||
module Katello | ||
class UpstreamConnectionCheckerTest < ActiveSupport::TestCase | ||
def setup | ||
@organization = get_organization | ||
@checker = Katello::UpstreamConnectionChecker.new(@organization) | ||
end | ||
|
||
def test_all_good | ||
Katello::Resources::Candlepin::UpstreamConsumer.expects(:ping).returns | ||
@organization.expects(:manifest_expired?).returns(false) | ||
|
||
assert @checker.assert_connection | ||
end | ||
|
||
def test_disconnected | ||
Setting[:content_disconnected] = true | ||
|
||
assert_raises Katello::Errors::DisconnectedMode do | ||
@checker.assert_connection | ||
end | ||
ensure | ||
Setting[:content_disconnected] = false | ||
end | ||
|
||
def test_manifest_expired | ||
@organization.expects(:manifest_expired?).returns(true) | ||
|
||
assert_raises Katello::Errors::ManifestExpired do | ||
@checker.assert_connection | ||
end | ||
end | ||
|
||
def test_upstream_ping | ||
@organization.expects(:manifest_expired?).returns(false) | ||
Katello::Resources::Candlepin::UpstreamConsumer.expects(:ping).raises(Katello::Errors::UpstreamConsumerGone) | ||
|
||
assert_raises Katello::Errors::UpstreamConsumerGone do | ||
@checker.assert_connection | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.