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

fix tag operations in secretsmanager #7547

Merged
merged 2 commits into from Apr 1, 2024

Conversation

macnev2013
Copy link
Contributor

Description

This PR resolves the problem outlined in localstack/localstack#10477.

Breaking Scenarios

Scenario 1

  • Secret creation without tags.
  • Addition of tags to the secret.
  • Removal of all tags from the secret.
  • Describing the secret reveals a Tags key with an empty list []. (Previously, this functionality was defective in moto.)

Scenario 2

  • Secret creation without tags.
  • Addition of tags to the secret.
  • Complete tag removal using untag_resource by specifying all tags.
  • On describing the secret, it should not contain of any tags. (Previously, this was not correctly implemented in moto.)

Fixes

  • Changing the default value of tags to None to identify weather the tags ever added.
  • Addition of NoneType handling in filtering functions
  • Updated logic for untag_resource to remove multiple tags at once.

Testing

  • Updated existing test cases to cover the scenario fixed

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.07%. Comparing base (9aef694) to head (61538c9).
Report is 143 commits behind head on master.

Files Patch % Lines
moto/secretsmanager/models.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7547      +/-   ##
==========================================
- Coverage   95.88%   94.07%   -1.82%     
==========================================
  Files         843     1070     +227     
  Lines       82578    91824    +9246     
==========================================
+ Hits        79178    86380    +7202     
- Misses       3400     5444    +2044     
Flag Coverage Δ
servertests 29.57% <0.00%> (-2.96%) ⬇️
unittests 94.04% <93.75%> (-1.81%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bblommers bblommers added this to the 5.0.5 milestone Apr 1, 2024
Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you @macnev2013!

@bblommers bblommers merged commit 1d7d797 into getmoto:master Apr 1, 2024
39 of 40 checks passed
Copy link
Contributor

github-actions bot commented Apr 1, 2024

This is now part of moto >= 5.0.5.dev10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants