-
Notifications
You must be signed in to change notification settings - Fork 312
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
[Resolve #1451] Stop suppressing ClientError in describe_outputs #1452
[Resolve #1451] Stop suppressing ClientError in describe_outputs #1452
Conversation
This resolves a bug in `sceptre outputs` where all `ClientError` exceptions (e.g. `ExpiredToken`) are suppressed, for no apparent reason. In 682a306, (October 2018, commit summary "Move Stack operations from Stack to StackActions"), a big refactor had occurred. That refactor had introduced a public method `describe` in the `StackActions` class. A month later, in 182f0b6 (November 2018, commit summary "Implement algorithm to execute Stacks from StackGraph"), another big refactor occurred. A part of that refactor was to introduce an essentially duplicate method `_describe` and then in the `describe_output` method, catch all `ClientError` exceptions and always return an empty list. So far as I can tell, there was no good reason to introduce either the new method, or catch all `ClientError` exceptions. The suppression of exceptions may have been accidental, or a hack to get the unit tests to pass. This patch attempts to fix all of this up: - Duplicate method removed in favour of the public `describe` method. I have opted to keep the public method as the differ class is calling, making it public. - The change to `describe_outputs` is reverted. - The unit tests are rewritten.
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.
Generally LGTM, however the integration tests are failing for this change.. https://github.com/Sceptre/sceptre/actions/runs/8405338399/job/23307454058
I can't remember if this is because I already fixed it or what but I can't see any failing pipelines. All good to merge this now? |
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.
@alexharv074 please take a look at my last comment, it contains a link to the integration test run.
I could be off base here but I do not think these 'describe stack' tests are needed and have tentatively deleted them. The scenarios like "the user describes resources in stack_group" refers to things that the user in fact cannot do and these are in effect integration tests on private methods. The tests were previously passing because the describe method called was swallowing up all exceptions and this is the bug this PR attempts to fix. The second problem here is that keeping these tests would require us to now somehow test for exceptions being raised (remembering that these tests are really testing a private method and not something that the user can actually do). It looks like this is possible e.g. https://stackoverflow.com/questions/27894993/handling-exceptions-in-python-behave-testing-framework but would inevitably be a bit hacky. I personally feel that these code paths are already tested by unit tests and therefore deleting these integration test cases could be acceptable. |
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.
Generally LGTM. Just seeing if there is an opportunity to do more cleanup?
This resolves a bug in
sceptre outputs
where allClientError
exceptions (e.g.ExpiredToken
) are suppressed, for no apparent reason.In 682a306, (October 2018, commit summary "Move Stack operations from Stack to StackActions"), a big refactor had occurred. That refactor had introduced a public method
describe
in theStackActions
class.A month later, in 182f0b6 (November 2018, commit summary "Implement algorithm to execute Stacks from StackGraph"), another big refactor occurred. That refactor introduced an essentially duplicate method
_describe
called bydescribe_output
method, and then added code to catch allClientError
exceptions and return an empty list if one is raised.So far as I can tell, there was no good reason to introduce either the new method, or catch all
ClientError
exceptions. The suppression of exceptions may have been accidental, a hack to get the unit tests to pass (or for a reason I have not thought of yet!).Note that at the time of 182f0b6, the
describe_outputs
method that suppressed exceptions was not called anywhere other than in the CLIoutputs
commands:This patch attempts to fix all of this up:
Duplicate method removed in favour of the public
describe
method. I have opted to keep the public method as the differ class is calling it, which means it should be public.The Nov 2018 change to
describe_outputs
which introduced the present bug is reverted.Duplicate logic to handle the case of "stack does not exist" removed.
Tweak call to the
describe
method in the differ.PR Checklist
[Resolve #issue-number]
.poetry run tox
) are passing.poetry run pre-commit run --all-files
).and description in grammatically correct, complete sentences.
Approver/Reviewer Checklist
Other Information
Guide to writing a good commit