Skip to content

Duplication in iter_taggable_backends - #10179

Open
Jbat1Jumper wants to merge 2 commits into
getmoto:masterfrom
Jbat1Jumper:master
Open

Duplication in iter_taggable_backends#10179
Jbat1Jumper wants to merge 2 commits into
getmoto:masterfrom
Jbat1Jumper:master

Conversation

@Jbat1Jumper

Copy link
Copy Markdown

Adds a regression test for #10167. Every service backend registers itself in a global list (BackendDict._instances) the first time each AWS account uses it, but nothing checks whether it's already there. Once a second account has touched a service within a long-lived moto_server process, resourcegroupstaggingapi.get_resources() returns every other account's resources twice. This only shows up in server mode, since @mock_aws resets that list before and after every test.

@Jbat1Jumper

Copy link
Copy Markdown
Author

Just changing here

BackendDict._instances.append(self) # type: ignore[misc]
here to:

if self not in BackendDict._instances:  # type: ignore[misc]
    BackendDict._instances.append(self)  # type: ignore[misc]

should be enough to fix this?

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.

1 participant