-
Notifications
You must be signed in to change notification settings - Fork 116
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
Conditionally include Redis connection information #1484
Merged
dralley
merged 1 commit into
pulp:master
from
ekohl:9070-remove-redis-from-status-if-unused
Jul 14, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Set Redis connection information in status to null unless it's used. Redis is | ||
needed for RQ tasking or content caching. |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
"""Test the status page.""" | ||
import unittest | ||
|
||
from django.test import override_settings | ||
from jsonschema import validate | ||
from pulp_smash import api, cli, config, utils | ||
from pulp_smash.pulp3.constants import STATUS_PATH | ||
|
@@ -91,10 +92,20 @@ def verify_get_response(self, status): | |
""" | ||
validate(status, self.status_response) | ||
self.assertTrue(status["database_connection"]["connected"]) | ||
self.assertIsNotNone(status["redis_connection"]) | ||
self.assertTrue(status["redis_connection"]["connected"]) | ||
self.assertNotEqual(status["online_workers"], []) | ||
self.assertNotEqual(status["versions"], []) | ||
if self.storage == "pulpcore.app.models.storage.FileSystem": | ||
self.assertIsNotNone(status["storage"]) | ||
else: | ||
self.assertIsNone(status["storage"]) | ||
|
||
@override_settings(CACHE_ENABLED=False, USE_NEW_WORKER_TYPE=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had no idea this was a thing, neat! |
||
def verify_get_response_without_redis(self, status): | ||
"""Verify the response to an HTTP GET call when Redis is not used. | ||
|
||
Verify that redis_connection is null | ||
""" | ||
validate(status, self.status_response) | ||
self.assertIsNone(status["redis_connection"]) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you can't return null unless required=False?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought
required
was only used for creating resources. It usually allows the non-presence of the entire key rather than affectingnull
abilityThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must admit I didn't even check it and assumed it. Note that storage also already is optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness, from a current Pulp 3.14 without this patch. When I go to
/pulp/api/v3
using a browser (text/html):Note
storage
is not inrequired
. While it may describe inputs, it is the closest thing there is to also describe the output. That's why I think it still makes sense.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds fine to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing to check, IMHO is whether the bindings can parse the result without error.